Hello Shopify community,
I am working with Shopify’s Custom Pixel and have encountered a localization issue that I’m hoping to get some assistance with. Specifically, when I subscribe to the ‘product_viewed’ event, I’ve noticed that the event.data.productVariant.title value is automatically localized based on the user’s locale. For example, if a user is on the Italian locale, the product name is returned in Italian.
Here is a snippet of the code I am using:
analytics.subscribe('product_viewed', (event) => {
const productPrice = event.data.productVariant.price.amount;
const productTitle = event.data.productVariant.title;
const payload = {
event_name: event.name,
event_data: {
productPrice: productPrice,
productTitle: productTitle,
},
};
// ... rest of the code to handle the event
});
My store’s default language is Romanian and for consistency in my analytics, I need the product titles to always be in Romanian, regardless of the user’s current locale.
Is there an API or a command that can be used to ensure that the product titles are always returned in the store’s default language, rather than being localized?
Thank you in advance for your help!