Skip to main content

Localize Price

Convert prices from the native currency to the currently selected currency. This method uses the currently selected country and currency rules. Input priceDetails object
Example
Field NameTypeOptionalDescription
PricenumberNoThe single price of a product, to be converted.
ProductClassCoefficientnumberYesThe product class coefficient to be used in this price conversion. Use null if the product does not have a product class.
QuantitynumberNoThe quantity of the product to be converted. If no value is provided, a default value of 1 is used.
IsRoundingSkippedbooleanYesIf the field is true, the converted price will not be rounded. Do not provide this field if rounding is required.
Due to rounding rules, the individual product price must be used for the price parameter, not the line item subtotal.
Returned localizedPrice object
Field NameTypeDescription
ConvertedPricenumberThe converted price’s value.
SymboledPricestringThe converted price, formatted for the selected currency
CurrencySymbolstringThe currently selected currency symbol.

De-localize Converted Price

Convert the customer’s local currency back to the original currency. This method uses the rules from the current country and currency in the calculation. Example
Refer to LocalizePrice method to view the structure of the priceDetails and delocalizedPrice objects. The delocalizedPrice object is structured the same as the localizedPrice object.

Format Converted Price

Format an already converted price, using the currently selected currency. Input convertedPriceDetails object
Field NameTypeDescription
ConvertedPricenumberThe converted price, to be formatted using the selected currency.
Returned formattedPrice object
Field NameTypeDescription
SymboledPricestringThe converted price, formatted for the selected currency.
CurrencySymbolstringThe currently selected currency symbol.

Is Operated by Global-e

Check if the currently selected shipping destination country is a Global-e-operated country. Example

Get Checkout URL

Get the checkout URL that you want to direct customers to. urlParams is a JSON object with a single CartToken string parameter. If you have a headless Shopify site, use the ShopifyCheckoutId instead of the CartToken. Example

Update Cart

Receive a notification when the cart needs to be updated on the client side, using this latest cartData that is passed in. Example
The following events trigger this method:
  • A product is added to the cart
  • A product is removed from the cart
  • The quantity of a product is changed
  • The cart is shown to the user
cartData cartDatais a JSON object that matches a specific schema. Example
productsList productsList is an array of product objects, detailed below:
Field NameTypeDescription
NamestringThe name of the discount.
OriginalDiscountValuenumberThe value of the discount, in your native currency.This value is converted to the customer’s selected currency
ProductCartItemIdstringThe “CartItemId of the product this discount is for.

Troubleshooting failed code

If you attempted to use a GEM external method and the code failed, this could be because the GEM module has not loaded yet. In this situation, you can use an ExternalEventsComponent With the ExternalEventsComponent you can set a function on the window object and Global-e’s code executes that function when a certain event is triggered. We recommend that you listen for the GlobalE_Loaded event before executing the code. To do this, set the below function on the window object and the code will be executed when the GEM solution loads. Example