Home / Admin / On Add to Cart Event in WooCommerce
Duplicate Snippet

Embed Snippet on Your Site

On Add to Cart Event in WooCommerce

Adds the cancellation event to stop the Browse Abandonment campaign for your push subscribers in the WooCommerce Store.
Next, it initializes the Cart Abandonment Campaign for push subscribers who abandon products in the cart to send web push campaigns.

Code Preview
php
<?php
add_action( 'woocommerce_add_to_cart', 'pe_wc_cart_script', 10, 6);
add_action( 'wp_enqueue_scripts', 'pe_wc_cart_ajax_script' );
function pe_wc_cart_script( $cart_item_key, $product_id, ...$rest_params ) {
  $browse_campaign_name = 'Enter browse abandonment campaign name';
  $cart_campaign_name = 'Enter cart abandonment campaign name';
  do_action('pe_wpcode_wc_cart_script', $product_id, $browse_campaign_name, $cart_campaign_name);
}
function pe_wc_cart_ajax_script() {
  $browse_campaign_name = 'Enter browse abandonment campaign name';
  $cart_campaign_name = 'Enter cart abandonment campaign name';
  do_action('pe_wpcode_wc_cart_ajax_script', $browse_campaign_name, $cart_campaign_name);
}

Comments

Add a Comment