Pergunta

I am pulling customer data by email like below:

    $url = "https://www.magento2d.com/rest/storecode/V1/customers/search";
    $filters = "?searchCriteria[filterGroups][0][filters][0][field]=email&searchCriteria[filterGroups][0][filters][0][value]=" . urlencode($email) . "&searchCriteria[filterGroups][0][filters][0][condition_type]=equal";
    //$filters2 = "&searchCriteria[filterGroups][0][filters][0][field]=created_in&searchCriteria[filterGroups][0][filters][0][value]=Store%20View&searchCriteria[filterGroups][0][filters][0][condition_type]=equal";
    $response = $this->curlIt("GET", $url . $filters);
    echo $response["total_count"];

This, however, seems to pull customers for both stores. I tried by setting the store code etc in the URL however the same happens and get 2 results for the user in both stores. I have also tried by adding another search criteria inf $filters2 however that seemed to be an OR statement.

The store code seems correct as no error is thrown unlike when I get the store code wrong. Using "default" similarly pulls both users. How do I just get the customers from the 1 store?

Outras dicas

just a question, are you really sure that this method you are developing is the correct one and that there is no better choice for what you need?

Anyway, have you looked here? https://devdocs.magento.com/guides/v2.4/rest/performing-searches.html

Cheers

Licenciado em: CC-BY-SA com atribuição
Não afiliado a magento.stackexchange
scroll top