Headless Docs
Latest (1.2.3)
Latest (1.2.3)
  • Overview
  • Change Log
  • General Steps
    • Update Prices on Page
    • Update ATC Events
      • Shopify Functions
      • Shopify Plus + Scripts
    • Preview Your Site
    • Lite Mode
  • Next.js Steps
    • Requirements
    • Add Intelligems Provider
    • Track Page Views
    • Update Prices on Page
    • Update ATC Events
    • Preview Your Site
  • Next.js - App Directory Configuraiton
    • Requirements
    • Add Intelligems Provider
    • Track Page Views
    • Update Prices on Page
    • Update ATC Events
    • Preview Your Site
  • Gatsby Steps
    • Requirements
    • Add Intelligems Provider
    • Track Page Views
    • Update Prices on Page
    • Update ATC Events
    • Preview Your Site
  • Pack Digital Steps
    • Requirements
    • Add Intelligems Provider
    • Track Page Views
    • Update Prices on Page
    • Update ATC Events
    • Preview Your Site
  • Shopify Hydrogen / Remix
    • Requirements
    • Update loader()
    • Add Intelligems Provider
    • Track Page Views
    • Update Prices on Page
    • Update ATC Events
    • Preview Your Site
  • Examples
    • Custom Events
    • Content Testing
    • Gift With Purchases
  • Reference
    • Providers
      • Provider Props
    • Components
      • Price Components
    • Hooks
      • Price Hooks
      • Offer Hooks
      • Track Hooks
      • Experience Hooks
      • Variation Hooks
      • Cart & Checkout Hooks
Powered by GitBook
On this page
  1. Examples

Gift With Purchases

Additions and removals of Gift with Purchases must be handled by the site. In general, the following steps are needed:

  1. Determine if the cart qualifies for a GWP

    1. If yes, follow the Add GWP steps below

    2. If no, remove the GWP if already it's in the cart

Add GWP Steps

const experienceId = 'abc123';

const igOffer = useIgOffer(experienceId>
const igOfferTier = useIgOfferTier(experienceId, units);

if (igOffer.offer && igOfferTier.tier?.isGiftWithPurchase){
    const giftWithPurchaseProductId = igOfferTier.giftWithPurchaseProductId;
    const giftWithPurchaseVariantId = igOfferTier.giftWithPurchaseVariantId;
    
    const lineItemProperty = {
    key: '_igGWP'
    value: igOffer.offer.id.split("-").pop()}
    
    // Add item to the cart with the above line item property
}

PreviousContent TestingNextProviders

Last updated 7 months ago