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.
Variables
Orbe creates a JS variable called orbeCountryCode and access it with mdApp_orbeCountryCode function, which allows developers to access the country where the customer is located based on their IP address. This object returns the country code where the customer is browsing, which can be used to customize the theme further.
Here is an example of how to use this object:
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