Skip to main content
During checkout, Ollie Shop exposes session data through global objects in the browser. These objects contain all the information about the current checkout state—cart items, user data, shipping options, payment methods, and more.

Available Session Objects

ObjectDescription
window.__CHECKOUT_SESSION__Ollie Shop’s normalized session with a consistent structure across all platforms
window.__RAW_CHECKOUT_SESSION__The raw session data from your e-commerce platform (VTEX, Shopify, etc.)
Use __CHECKOUT_SESSION__ for a consistent data structure regardless of your e-commerce platform. Use __RAW_CHECKOUT_SESSION__ when you need platform-specific fields not available in the normalized version.

Ollie Shop Session Structure

The __CHECKOUT_SESSION__ object provides a clean, normalized structure:
{
  "id": "4d300fb5d13246a1873ef69a650c9a78",
  "cartItems": [
    {
      "id": "14",
      "name": "Soccer Shirt S",
      "variant": "S",
      "brand": "Ollie",
      "category": "Apparel",
      "quantity": 1,
      "price": 5000,
      "originalPrice": 5000,
      "available": true,
      "index": 0,
      "image": "https://example.com/image.png",
      "url": "/soccer-shirt/p"
    }
  ],
  "customerPreferences": {
    "saveData": false,
    "locale": "en-US"
  },
  "shipping": {
    "addresses": [],
    "packages": [],
    "availableQuotes": [],
    "availableCountries": ["USA", "BRA", "NLD"]
  },
  "payment": {
    "availableMethods": [
      {
        "id": "1",
        "type": "credit_card",
        "name": "American Express",
        "installments": [
          { "number": 1, "amount": 5000, "total": 5000, "interestRate": 0 }
        ]
      }
    ],
    "selectedPayments": [],
    "giftCards": [],
    "total": 0,
    "savedCards": []
  },
  "locale": {
    "currency": "USD",
    "country": "USA",
    "language": "en-US"
  },
  "taxes": [],
  "totals": {
    "items": 5000,
    "total": 5000
  },
  "user": {
    "role": "user",
    "isGuest": true
  },
  "readOnly": false
}

Key Properties

PropertyTypeDescription
idstringUnique session identifier
cartItemsarrayProducts in the cart with normalized properties
userobjectUser information including isGuest status
localeobjectCurrency, country, and language settings
totalsobjectOrder totals (items, shipping, discounts, total)
shippingobjectShipping addresses, packages, and available quotes
paymentobjectAvailable payment methods and selected payments

Raw Platform Session (VTEX Example)

The __RAW_CHECKOUT_SESSION__ object contains the unmodified data from your e-commerce platform. This example shows the VTEX orderForm structure:
{
  "orderFormId": "4d300fb5d13246a1873ef69a650c9a78",
  "salesChannel": "1",
  "loggedIn": false,
  "isCheckedIn": false,
  "storeId": null,
  "allowManualPrice": false,
  "canEditData": true,
  "userProfileId": null,
  "userType": null,
  "value": 5000,
  "messages": [],
  "items": [
    {
      "uniqueId": "A1CAC2C73CCE4C7C985F60DAF99C1599",
      "id": "14",
      "productId": "4",
      "refId": "OLL-SOCCER-S",
      "name": "Soccer Shirt S",
      "skuName": "S",
      "price": 5000,
      "listPrice": 5000,
      "sellingPrice": 5000,
      "quantity": 1,
      "seller": "1",
      "imageUrl": "https://example.com/image.png",
      "detailUrl": "/soccer-shirt/p",
      "availability": "available",
      "additionalInfo": {
        "brandName": "Ollie",
        "brandId": "2000001"
      },
      "productCategories": {
        "2": "Apparel"
      }
    }
  ],
  "totalizers": [
    { "id": "Items", "name": "Items Total", "value": 5000 }
  ],
  "shippingData": {
    "address": null,
    "logisticsInfo": [
      {
        "itemIndex": 0,
        "selectedSla": null,
        "shipsTo": ["USA", "BRA", "NLD"]
      }
    ],
    "selectedAddresses": []
  },
  "clientProfileData": null,
  "paymentData": {
    "paymentSystems": [
      {
        "id": 1,
        "name": "American Express",
        "groupName": "creditCardPaymentGroup"
      }
    ],
    "payments": [],
    "giftCards": []
  },
  "sellers": [
    { "id": "1", "name": "VTEX - EUA", "logo": "" }
  ],
  "storePreferencesData": {
    "countryCode": "USA",
    "currencyCode": "USD",
    "currencySymbol": "$"
  }
}
For a complete reference of all VTEX orderForm fields, see the VTEX orderForm Fields documentation.
The __RAW_CHECKOUT_SESSION__ structure varies by platform. The properties shown above are specific to VTEX. Shopify and other platforms will have different structures.

Accessing Session Data

In Custom Components

Use the useCheckoutSession hook to access session data reactively in your components:
import { useCheckoutSession } from "@ollie-shop/sdk";

export default function MyComponent() {
  const { session } = useCheckoutSession();

  return <p>Total: {session.totals.total}</p>;
}

In GTM Custom HTML Tags

Access the global objects directly in GTM Custom HTML tags:
<script>
  var session = window.__CHECKOUT_SESSION__ || {};
  var rawSession = window.__RAW_CHECKOUT_SESSION__ || {};

  console.log('Is guest:', session.user?.isGuest);
  console.log('VTEX logged in:', rawSession.loggedIn);
</script>