Block Client API

AddProductToCart1

Add the given product variant to the current cart.

MethodpostMessage
Message Data{ "bubblehouseBlockClientCall": "AddProductToCart1", ... }

In case your store uses vendibles (products redeemed for points) or free samples (products added to orders as a free bonus), this call is used to add those products to cart for custom and headless stores.

You don't always need to implement this call. We automatically handle supported online stores that provide a first-party Cart API, a prime example being non-headless Shopify (i.e. non-Hydrogen). In those case, do not impement AddProductToCart call unless Bubblehouse team tells you to.

Query Parameters

  • instancestringrequired

    Block instance identifier passed to the Blocks API.

    Empty string if an instance identifier has not been provided.

  • variantIdstringrequired

    Online store ID of the product variant to be added.

    This is the primary identifier of what is to be added to the cart.

    In case of Shopify, this is an integer and does not include the gid://shopify/ProductVariant/ prefix.

    In case of online shop systems without a notion of product variants, this is set to the product ID (i.e. is equal to the value of productId).

  • quantityintegerrequired

    The quantity of the product to add.

Previous
ApplyDiscountCode1