INTEGRATION WITH BOGOS JS/SDK
This page provides an overview of the key requirements for integration with the BOGOS app via the BOGOS JS/SDK. It is recommended to read this page thoroughly before proceeding to the next sections
1. Requirements
Install BOGOS app: https://apps.shopify.com/freegifts
Your store must be built using the Storefront API.
For advanced customization in your Headless store, refer to the BOGOS API documentation.
Please refer to BOGOS' Demo store for all features demo: Demo store
2. Installation
Version source
BOGOS_JS_SDK=https://cdn.bogos.io/bogos-app-ext/20251217-1765947613/core.min.jsStep 1: Getting started
Add the following script to your project:
<script id="bogos-core" src={{BOGOS_JS_SDK}} defer data-storefront-api-token={{PUBLIC_STOREFRONT_API_TOKEN}} data-api-version={{PUBLIC_STOREFRONT_API_VERSION}} data-myshopify-domain={{MYSHOPIFY_DOMAIN}} data-bogos-key={{BOGOS_KEY}} />Property
Description
Example
VERSION_SOURCE: String!The script URL for the current version
https://cdn.bogos.io/{{version}}/core.min.js
💡 Example Available 👉 root.tsx
Update your project with the required BOGOS data:
typeof window !== 'undefined' && typeof window.BOGOS_CORE !== 'undefined' && window.BOGOS_CORE?.helper?.updateCore(option: BOGOSOptions)export type BOGOSOptions = { cart?: Cart; customer?: string | Customer; locale?: string; https://shopify.dev/docs/api/storefront/latest#@inContext-(Language) country?: string; https://shopify.dev/docs/api/storefront/latest#@inContext-(Country-Code) currency?: { active: string; rate: number; }; market?: { id: number; handle: string; } };Note:
You must provide at least one of the above properties.
If you provide the full Cart object, BOGOS will not fetch the cart again.
If only the Cart ID is provided, BOGOS will fetch the cart again.
The customer parameter can be either a customer access token or customer object
💡 Example Available 👉 root.tsx 👉 Layout.tsx 👉 Cart.tsx
Step 2: Gift Offer
Add prepareCheckout to your checkout process to validate gift items before proceeding to checkout:
💡 Example Available 👉 Cart.tsx
Customize
3.1. Gift Icon & Gift thumbnail
On the product page Add class "fg-secomapp-product-title" where you want to display gift icon Add class "bogos-gift-thumbnail-view" where you want to display gift thumbnail
or
💡 Example Available 👉 products.$handle.tsx
For collection page Add class "fg-secomapp-collection-img" to where you want to display gift icon on product card
💡 Example Available 👉 collections.$handle.tsx
3.2. Cart message
Add the class "bogos-cart-message-view" to the element where you want the message displayed
3.3. Gift slider
To embed the gift slider instead of displaying as a popup, include the following code:
Step 3: Bundle Offer
Classic bundle
Add the following element to where you want to display the bundle offer.
Dispatch this element to render the bundle offer
or
💡 Example Available 👉 products.$handle.tsx
Mix-match
Add the following element to where you want to display the bundle offer.
Dispatch this element to show bundle offer
or
💡 Example Available 👉 products.$handle.tsx
Step 4: Bundle Page
Add the following element to where you want to display the bundle offer.
Dispatch this element to render the bundle offer.
💡 Example Available 👉 bundle-page.$id.tsx
Step 5: Upsell Offer
Frequently Bought Together (FBT)
Add the following element to where you want to display the upsell offer
Dispatch this element to render the upsell offer
💡 Example Available 👉 products.$handle.tsx
Step 6: Discount Offer
Volume Discount
Add the following element to where you want to display the discount offer
Dispatch this element to render the discount offer
or
💡 Example Available 👉 products.$handle.tsx
Step 7: Booster
Progressing bar
Add the following element to where you want to display the progressing bar
Dispatch this element to render the progressing bar
💡 Example Available 👉 Cart.tsx
Today offer
Add the following element to where you want to display the today offer block
Dispatch this element to render the today offer block and today offer widget
💡 Example Available 👉 _index.tsx 👉 Cart.tsx
3. Other integrations
3. 1. Hide gift product (cloned product)
If you use products query, you should add :
query: "tag_not:bogos-gift"
For collection and product page, you can import
checkItemIsGiftand use returned value to skip gift products or replace to other pages
💡 Example Available 👉 collections.$handle.tsx 👉 products.$handle.tsx
3.2. Customize gift popup/slider
Hide all default gift slider elements, and override with your custom implementation.
3.3. Details of additional event listeners
fg-gifts:updated: Event gift is updated in cart
💡 Example Available 👉 Layout.tsx
fg-cart:auto-updated: Event gift auto add
fg-gifts:added: Event add gift from slider, will not work if you customize gifts popup
fg-gifts:gift-icon: Show gift iconsbogos:message: Show cart message
4. Note
4.1. Publish Gift/Cloned Products
After creating or editing an offer, ensure that the gift/cloned product is published to your Headless channel (or any channel where you want BOGOS to run).
4.2. Some features are not yet available in this version
Draft-Order API
Automatic volume discount
Bundle page button block
Some Shopify object-based params (if only id provided, BOGOS will fetch the rest).
Last updated