Developer Guide
API GuideDeveloper Guide
  • Overview
    • Getting Started
    • Customers and Visitors
    • Events and Business Objects (BOs)
      • Sample Event Templates
  • Website
    • Getting Started
      • Direct JS Implementation
      • JS Integration via GTM
      • Tracking Haravan website events
    • Tracking Users
    • Tracking Events
      • [Direct] Sample E-Commerce Events
        • View Product
        • Add a Product to the Shopping Cart
        • View the Shopping Cart
        • Remove a Product from the Shopping Cart
        • Search for Product(s)
        • Checkout Shopping Cart
        • Apply Promotion Code
        • Purchase Product(s)
      • [GTM] Sample E-Commerce Events
        • View Product
        • Add a Product to the Shopping Cart
        • View the Shopping Cart
        • Remove a Product from the Shopping Cart
        • Search for Product(s)
        • Checkout Shopping Cart
        • Apply Promotion Code
        • Purchase Product(s)
    • Web Push
  • Android
    • Getting Started
    • Tracking Users
    • Tracking Events
    • Push Messaging
    • App Inbox Messaging
  • iOS
    • Getting Started
      • Integration of Antsomi iOS SDK
    • Tracking Users
    • Tracking Events
    • Push Messaging
  • Hybrid Apps
    • React Native
      • Tracking Users
      • Tracking Events
        • Sample E-Commerce Events
          • View Product
          • Add a Product to the Shopping Cart
          • View the Shopping Cart
          • Remove a Product from the Shopping Cart
          • Search for Product(s)
          • Checkout Shopping Cart
          • Apply Promotion Code
          • Purchase Product(s)
      • Push Messaging
      • App Inbox Messaging
    • Flutter
      • Tracking Users
      • Tracking Events
        • Sample E-Commerce Events
          • View Product
          • Add a Product to the Shopping Cart
          • View the Shopping Cart
          • Remove a Product from the Shopping Cart
          • Search for Product(s)
          • Checkout Shopping Cart
          • Purchase Product(s)
      • Push Messaging
      • App Inbox Messaging
      • App In-line Content
  • Antsomi Service Integrations
    • Media Template
    • Media JSON
      • Sample E-Commerce Events
        • Search for Product(s)
        • View Product
        • Add a Product to the Shopping Cart
        • Checkout Shopping Cart
        • Purchase Product(s)
      • Sample User Events
        • Sign-in
        • Sign-up
      • Sample Opt-in Events
        • Subscribe to Email marketing
        • Subscribe to OneSignal channel
  • 3rd Party Integrations
    • Shopify
      • Tracking Shopify website events
    • LINE
      • Integrating LINE Login with your web app
    • Google Ad Manager
      • Targeting CDP365 segment via PPID(s)
Powered by GitBook
On this page
  1. Hybrid Apps
  2. Flutter
  3. Tracking Events
  4. Sample E-Commerce Events

Remove a Product from the Shopping Cart

When user removes a product from their shopping cart, indicating a change in their purchase decision.

import 'package:antsomisdk/antsomi.dart'; // Contains Antsomi SDK APIs
import 'package:antsomisdk/cdp_event.dart'; // Contains the CDPEvent class

final event = CDPEvent(en: 'remove_cart_product');
List<Map<String, dynamic>> items = [];

// Build event data
// Replace with your object
final productDetail = value['product'] as Product;
  
items.add({
  'type': 'product',
  'id': productDetail.sku ?? '',
  'name': productDetail.name ?? '',
  'sku': productDetail.sku,
  'quantity': value['quantity'] as int,
});

// Include the Multiple-Objects (items) in the event data
event.items = items;

// Set the Customer Objects to the event data
event.setCustomerProps = {
  'customers': {    
    'name': user.name ?? '',
    'customer_id': MD5Hash().generateMd5(user.email ?? ''),
  }
};

// Include more Event Attributes (extra) in the event data
addToCartEvent.eventProps = {
  'event_source': 'remove_cart',
  'cart_subtotal': cartModel.getTotal() ?? 0.0,
  'cart_item_count': cartModel.totalCartQuantity
};

// Initialize AntsomiSDK object
antsomiSdk = Antsomi();

// Send the event data to CDP
antsomiSdk.track(event: event);
PreviousView the Shopping CartNextSearch for Product(s)

Last updated 11 months ago