Remove from cart

The following describes how remove from cart tracking is done for Firework.

How to implement the "remove_from_cart" tracking event

<script>
    function onAddToCart() {
        window._fwn.analytics.removeFromCart({
            ext_customer_identifier: '123'
            currency: 'CAD',
            country: 'Canada',
            subtotal: '31.89',
            product: [{ 
                ext_parent_product_id: '6692',
                parent_product_name: 'V-Neck Tshirt',
                ext_product_id: '4483', 
                product_name: 'V Neck Tshirt - L Blue', 
                image: 'http://example.com/t-shirt/t-shirt.png'
                price: 31,
                currency: 'CAD',
                sku: 't-shirt',
                quantity: 1                
            }]
        });
    }
    
    // Calls onRemoveFromCart() whenever there is add to cart happening
</script>

Note: The remove from cart function expects the following input shape:

export interface RemoveFromCartData {
  ext_customer_identifier?: string
  currency: string
  country: string
  subtotal: number
  product: Array<{ 
    ext_parent_product_id:string; 
    parent_product_name:string;  
    ext_product_id:string; 
    product_name:string; 
    image?: string;
    price: number; 
    currency?: string;
    sku?: string;
    quantity: number 
  }>
}

Last updated