woocommerce / pinterest-for-woocommerce

A native Pinterest integration for WooCommerce. Development is managed by Ventures.
https://woocommerce.com/products/pinterest-for-woocommerce/
GNU General Public License v3.0
22 stars 9 forks source link

Replacing determine_locale with get_locale. #1035

Closed message-dimke closed 1 month ago

message-dimke commented 1 month ago

Changes proposed in this Pull Request:

We need the locale from the website, not from the request. Replacing determine_locale with the get_locale function call.

How to test

You can reproduce the error by:

  1. Have a connected site with a feed in the site's default language
  2. Activate the Pinterest logs
  3. Change the language of your user (or create a new user with a different language than the site default)
  4. Trigger the run of the scheduled action handle_feed_registration when logged in as that user.
  5. Check the logs and you will see the creation of the feed with the user's locale

I checked some of the sites that were experiencing this issue. The site's language was different than the language of the admin user in WordPress.com. (Ex: en_GB on the site and en_US on the user, or en_US on the site and es_ES on the user)

Thanks, @brezocordero !

Changelog entry

Tweak - replace locale source function.

brezocordero commented 1 month ago

@message-dimke This PR fixes the issue with a site deleting/creating feeds with different locales.

You can reproduce the error by:

I checked some of the sites that were experiencing this issue. The site's language was different than the language of the admin user in WordPress.com. (Ex: en_GB on the site and en_US on the user, or en_US on the site and es_ES on the user)

I was able to reproduce the problem on @ecgan's test site (🙌 ) and tested that your PR fixes the issue.

brezocordero commented 1 month ago

@message-dimke Just a small comment: https://github.com/woocommerce/pinterest-for-woocommerce/pull/1035/files#diff-6b87af8f96b95295b23a6683666ce043f4b648d1c56550cf813f4660911b627bR35 should remove locale