For the complete documentation index, see llms.txt. This page is also available as Markdown.

App functions

The application defines several functions to enable callbacks and customization everywhere.

* Calling functions correctly

To ensure the custom code always works, even if you uninstall the application, the added code will not affect the theme. This is very important!

// Always check if the application is installed before calling the app function.
if(typeof Globo != 'undefined' && typeof Globo.Preorder != 'undefined'){
// code here
}
  • Or you can also use try-catch blocks to wrap custom code to avoid exception errors.

try{
// code here
} catch (error) {}

1. Re-render in product page

In some cases, the app theme does not re-render after a variant change.

// after variant changed 
if(typeof Globo != 'undefined' && typeof Globo.Preorder != 'undefined'){
 Globo.Preorder.initPreorder();
}

2. Re-render in collection page

In some cases, the app theme does not re-render after collection filtering, sort, paginate

  • Suggest products in the footer, using this code similarly.

3. Helper functions

1. Search product

  • Globo.Preorder.searchProductByJson(chunkProducts = [])

  • Example

2. Get profile product

  • Required productJson variantId

  • Globo.Preorder.getResolvedProfile(productJson, variantId)

  • Example get product profile and check status product

3. Get payment options & discount product preorder

4. Get messages

  • Get messages by default translate, use Globo.Preorder.settings.translation

  • Get messages by profile, this is last text after translated by current locale

5

Last updated

Was this helpful?