I am writing a module to send alert email to customer when a product is available. I have different email template with name like "alertmail EN", "alertmail FR"...

I can't do


Because the mail is send by a cron. How can I get locale code by customer?

  • If you've got locales set at store level you can't. Customers are created at website level which means they can have multiple locales. I recommend you try and work out which locale customer last ordered from and go from there. Oct 5, 2019 at 12:19
  • I just had to load customer_address_entity and get country_id Oct 7, 2019 at 12:46
  • Makes sense. Same idea as my suggestion just different approach. Yours will be more efficient as more likely to have multiple orders but single address. Oct 7, 2019 at 12:50


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.