Skip to main content

product_removed_from_cart
interface

The product_removed_from_cart event logs an instance where a customer removes a product from their cart. This event is available on the online store page.

string

The client-side ID of the customer, provided by Shopify

string

The ID of the customer event

string

The name of the customer event

number

The sequence index number of the event.

string

The timestamp of when the customer event occurred, in ISO 8601 format

.Standard
Was this section helpful?

Accessing Standard Events

import {register} from '@shopify/web-pixels-extension';

register(({analytics}) => {
analytics.subscribe('product_removed_from_cart', (event) => {
// Example for accessing event data
const cartLine = event.data.cartLine;

const cartLineCost = cartLine.cost.totalAmount.amount;

const cartLineCostCurrency = cartLine.cost.totalAmount.currencyCode;

const merchandiseVariantTitle = cartLine.merchandise.title;

const payload = {
event_name: event.name,
event_data: {
cartLineCost: cartLineCost,
cartLineCostCurrency: cartLineCostCurrency,
merchandiseVariantTitle: merchandiseVariantTitle,
},
};

// Example for sending event to third party servers
fetch('https://example.com/pixel', {
method: 'POST',
body: JSON.stringify(payload),
keepalive: true,
});
});
});