smootify:added_to_cart
lines were added, after the cart came back: once per add to cart, a product with its add-ons included (the main line first); when the add-ons fail, the main line that went in alone
On this page
lines were added, after the cart came back: once per add to cart, a product with its add-ons included (the main line first); when the add-ons fail, the main line that went in alone Since 1.x.
Listen
window.Smootify = window.Smootify || [];
window.Smootify.push((api) => {
api.on("added_to_cart", (payload) => {
// …
});
});Payload
{ lines: CartLineInput[]; cart: Cart; goToCheckout: boolean }Cart
export interface Cart {
/** `gid://shopify/Cart/<id>` */
id: string;
checkoutUrl: string;
totalQuantity: number;
note: string | null;
attributes: Attribute[];
buyerIdentity: {
countryCode: string | null;
email: string | null;
phone: string | null;
customer: {
id: string;
email: string | null;
firstName: string | null;
lastName: string | null;
displayName: string;
} | null;
};
lines: { nodes: CartLine[] };
cost: {
subtotalAmount: Money;
totalAmount: Money;
totalDutyAmount: Money | null;
totalTaxAmount: Money | null;
subtotalAmountEstimated: boolean;
totalTaxAmountEstimated: boolean;
};
discountCodes: { code: string; applicable: boolean }[];
appliedGiftCards: { id: string; lastCharacters: string; amountUsed: Money; balance: Money }[];
discountAllocations: DiscountAllocation[];
}CartLineInput
/** A line to add: `merchandiseId` is the variant gid. */
export interface CartLineInput {
merchandiseId: string;
quantity?: number | null;
attributes?: AttributeInput[] | null;
sellingPlanId?: string | null;
parent?: { lineId?: string | null; merchandiseId?: string | null } | null;
}