Appearance
Shopify App: Extending with Custom Functionality
While the Relewise Shopify app offers many features out of the box, you can extend its functionality with custom implementations. To facilitate this, Relewise exposes a global object called ShopifyRelewise that provides access to core functionality.
Accessing the User Object
The ShopifyRelewise object includes a getUserAsync function that returns the user object needed to search, track or recommend using Relewise.
javascript
const user = await ShopifyRelewise.getUserAsync();Getting the request currency
When the Relewise UI app embed is active, use ShopifyRelewise.getMarketCurrency() to get the currency key for Relewise search, recommendation, and cart tracking requests:
javascript
const currency = ShopifyRelewise.getMarketCurrency();The function returns the currency key used by the app for the current storefront. With Market Pricing, this combines Shopify's active currency with the selected country, for example EUR-NL. Use the returned value directly as the request currency to keep custom requests aligned with the app.
For displaying prices, use Shopify's actual currency code with your currency formatter:
javascript
const priceFormatter = new Intl.NumberFormat(Shopify.locale, {
style: "currency",
currency: Shopify.currency.active,
});Combined keys such as EUR-NL select prices in Relewise; currency formatters require a currency code such as EUR.