0

I'm making an export file of customer email addresses. Magento is set up to have two store views, each in different languages. How can I find out which store view the customer belongs to (i.e. her language)?

0

The customer_entity table has a column store_id.

You can access it for example with $customer->getStoreId();

If you export the customers using your own class, you can add \Magento\Store\Model\StoreManagerInterface as a dependency in the constructor. Then just loop over $this->_storeManager->getStores(true); and check if the store-ID matches to get the store code.

0

You can use: vendor/magento/module-customer/Block/Adminhtml/Edit/Tab/View/PersonalInfo.php:298 as an example to achieve what you want:

public function getCreatedInStore()
{
    return $this->_storeManager->getStore(
        $this->getCustomer()->getStoreId()
    )->getName();
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.