JavaScript
Use Orbe's variables and functions for your custom localization needs
Developers only: This documentation is intended for developers with technical knowledge and experience in Shopify Theme Development.
Functions
Geolocation popup | Market Selector Popup |
---|---|
|
|
Use these JavaScript functions to manage popup behavior:
Function | Description |
---|---|
| Opens the "Geolocation Popup" and automatically updates to match the user's current location and browser language preferences. |
| Opens the "Geolocation Popup" but maintains the user's current selections within the Shopify storefront, avoiding any refresh. |
| Opens the "Market Selector" modal type. |
| Closes the "Geolocation Popup". |
| Closes the "Market Selector" Popup |
Important notice
To utilize these JavaScript functions effectively, ensure that the corresponding app embeds are enabled.
The "Geolocation Popup" should be activated for using orbito
related functions, and the "Market Selector" should be enabled for orbitoMK
functions.
Object
Orbe creates a JS object called orbito
with both properties and methods to access geographical information about the user’s location.
Summary of orbito
methods:
orbito
methods:Method | Description | Example output |
---|---|---|
| Country code based on the user location |
|
| Region/state short code (FIPS or ISO format) directly based on the user location |
|
Here is an example of how to use the method orbito.getRemoteCountryCode()
:
This code will log the message "User is in the UK" to the console only if the user is located in the United Kingdom, based on the orbeCountryCode
object. You can modify the message to suit your needs and use this code as a starting point for implementing other customizations based on the user's location.
For instance, you could show a message on the product pages of users in the UK saying "2-hour delivery". Here's some sample code to achieve this:
Note that you can adjust the delivery message based on the customer's country code, and the code above assumes you have a div element on your product pages with the class .delivery-message
where you want to show the delivery message.
If you have any questions or need additional assistance, please don't hesitate to contact us.
Last updated