I have a store with two websites and storeview. Let's say
Website = 1 and 2
Store view = 5 and 6
Storeview 6 is not directly visible and only registered customers will access it when they log in.
Customers use an option to register on website 2 and access storeview 6 on website 1 with storeview of 5.
I have a couple of additional fields and when the user completes them I will assign that user to website 2 and store view 6.
Users will receive related emails based on website and store view and everything works fine except Success email template for subscribe to the newsletter.
the correct email template is always sent from website1 storeview5.
I checked the administrator settings and the templates are configured correctly in the store settings-> customer-> newsletter.
Additionally, the customer will receive the correct email template after registration if they subscribe by logging into their account.
So it is not a problem with administrator settings.
I looked in the newsletter module archives and here
in the method
public function sendConfirmationSuccessEmail ()
seems to be the one who sets up the store
$this->_transportBuilder->setTemplateIdentifier( $this->_scopeConfig->getValue( self::XML_PATH_SUCCESS_EMAIL_TEMPLATE, MagentoStoreModelScopeInterface::SCOPE_STORE ) )->setTemplateOptions( ( 'area' => MagentoFrameworkAppArea::AREA_FRONTEND, //'store' => $this->_storeManager->getStore()->getId(), 'store' => 6, ) )->setTemplateVars( ('subscriber' => $this) )->setFrom( $this->_scopeConfig->getValue( self::XML_PATH_SUCCESS_EMAIL_IDENTITY, MagentoStoreModelScopeInterface::SCOPE_STORE ) )->addTo( $this->getEmail(), $this->getName() );
for tests purpose I manually commented the
& # 39; store & # 39; => $ this -> _ storeManager-> getStore () -> getId (),
and set id to 6. But it doesn't work. When I sign up, I keep getting 5 website templates and 5 store view.
BTW, the $ customer-> getStoreId () has the correct id of my desired site (2) and storeview (6). So it is not a problem with websiteId / StoreId of $ customer.
Does anyone have any idea why this happens? Is that identification established elsewhere?