Repository navigation
Replies: 1 comment
|
There's no per-event Unlike { cart, prevCart, currentLine, prevLine?, shop, customData, eventTimestamp }
So put the data on the cart line and read it from Option 1: line attributes (best for per-add values) <AddToCartButton
lines={[{
merchandiseId: selectedVariant.id,
quantity: 1,
attributes: [{key: '_isNonDtc', value: String(isNonDtc)}],
}]}
>subscribe('product_added_to_cart', ({currentLine}) => {
const isNonDtc = currentLine?.attributes
?.find((a) => a.key === '_isNonDtc')?.value === 'true';
});The skeleton's Option 2: query it on the product (best if it's a fixed product property) If Option 3: global Only works if the value is the same for the whole session (locale, market, customer type). |
Uh oh!
There was an error while loading. Please reload this page.
Adding custom data to an Analytics component such as ProductView is a breeze
such as:
But how do I pass custom data for the PRODUCT_ADD_TO_CART ?
As you can see from the screenshot this is the data that is passed to my analytics

subscribe('product_added_to_cart', (data) => {...})
All reactions