A way to add item properties when "Add to Cart" is triggered

Hi! I am looking for a way to send item properties when a user adds a product to the cart or uses the Buy Now option. Depending on the product, I need to attach a few item properties that are generated when the user interacts with my mini App.

Thanks for any guidance.

hi @Lucas_Sena, at this moment the only way to add items to the cart is using our AddToCartButton componenet (see docs).
But happy to learn more about your use case so that we could expand the component’s API in future iterations of the platform.

Thanks for the reply @Quique-Shopify!
Unfortunately the addToCart action doesn’t allow sending line item properties, do you know if there is another way to add items to the cart that would allow us to include these properties?

const {addToCart} = useShopCartActions()

export interface AddToCartParams extends BuyProductLineItem {
  /**
   * The discount codes to apply to the cart.
   */
  discountCodes?: string[]
  /**
   * Attribution data for the line item.
   * @deprecated
   */
  attribution?: LineItemAttribution
  /**
   * The URL of the variant image.
   */
  variantImageUrl?: string
}

The addToCart function was deprecated in the most recent SDK release. We will explore the possibility of incorporating line item properties into the AddToCartButton component in future platform iterations. At this time, I can’t provide a deadline.

1 Like