WordPress action hook
woocommerce_ajax_added_to_cart
Defined by WooCommerce and fired by 140 plugins in total, running on 7.8M+ sites between them.
“Added to cart Product ID.”
How to use woocommerce_ajax_added_to_cart
It's an action: your callback runs at that point and receives 1 argument. Nothing needs to be returned.
Add this to your theme's functions.php or a small custom plugin:
add_action( 'woocommerce_ajax_added_to_cart', function( $product_id ) {
// Your code runs here.
}, 10, 1 );Argument names come from WooCommerce's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
140 plugins that fire woocommerce_ajax_added_to_cart
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
WooCommerce7+ million installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/class-wc-ajax.php:596 -
Variation Swatches for WooCommerce200,000+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )inc/swatches.php:738 -
ShopLentor80,000+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )classes/class.ajax_actions.php:91 -
Side Cart Woocommerce70,000+ installs
do_action( 'woocommerce_ajax_added_to_cart', intval( $_POST['add-to-cart'] ) )includes/class-xoo-wsc-cart.php:74 -
Depicter70,000+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )app/src/Modules/WooCommerce/Module.php:39 -
HT Mega Addons for Elementor60,000+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/class.single-product-ajax-addto-cart.php:59 -
Quick Buy Now Button for WooCommerce50,000+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/class-woo_buy_now_button_frontend.php:285 -
Sliding Cart for WooCommerce by FunnelKit30,000+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/ajax.php:169 -
Product Addons for Woocommerce30,000+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/process/process.php:530 -
Booster for WooCommerce30,000+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/class-wcj-wishlist.php:386 -
WPC AJAX Add to Cart for WooCommerce10,000+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )wpc-ajax-add-to-cart.php:319 -
Quantity Plus Minus Button for WooCommerce10,000+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/features/quantiy-archive.php:113 -
Min Max Control10,000+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/features/quantiy-archive.php:100 -
ShopBuilder10,000+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )app/Controllers/Frontend/Ajax/AddToCart.php:62 -
WPC Frequently Bought Together for WooCommerce10,000+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/class-woobt.php:642 -
Variation Swatches for WooCommerce9,000+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )app/Controllers/Hooks.php:344 -
Cart Popup for WooCommerce9,000+ installs
do_action( 'woocommerce_ajax_added_to_cart', intval( $_POST['add-to-cart'] ) )includes/class-xoo-cp-core.php:112 -
Boostify Header Footer Builder for Elementor6,000+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )inc/elementor/module/class-woocommerce.php:327 -
Orderable5,000+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )inc/class-ajax.php:222 -
CartSuite5,000+ installs
do_action( 'woocommerce_ajax_added_to_cart', apply_filters( 'woocommerce_add_to_cart_product_id', absint( sanitize_text_field( wp_unslash( $_POST['add-to-cart'] ) ) ) ) )includes/frontend/frontend.php:72 -
Youzify4,000+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/public/core/woocommerce/class-youzify-wc-activity.php:75 -
CoDesigner4,000+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )app/AJAX.php:217 -
XT Floating Cart for WooCommerce4,000+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )xt-framework/includes/modules/add-to-cart/module-add-to-cart.php:311 -
WowStore4,000+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )addons/variation_swatches/VariationSwatches.php:806 -
Ultimate Store Kit3,000+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )modules/shiny-grid/module.php:174 -
DOOFINDER Search and Discovery for WP & WooCommerce2,000+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/class-add-to-cart.php:143 -
MKL Product Configurator for WooCommerce2,000+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )inc/ajax.php:942 -
Modal Fly Cart & AJAX Add to Cart for WooCommerce2,000+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )inc/class-frontend.php:171 -
Gift Wrapper for WooCommerce2,000+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/class-gift-wrapper-wrapping.php:316 -
PVT1,000+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )inc/frontend/class_pvtfw_cart.php:200 -
WC Builder1,000+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/single-add-to-cart-ajax.php:53 -
XT Ajax Add To Cart for WooCommerce1,000+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )xt-framework/includes/modules/add-to-cart/module-add-to-cart.php:295 -
WishSuite1,000+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/classes/Ajax.php:169 -
Smart Search & Product Filter for WooCommerce900+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/widgets/class-search-results.php:270 -
Unit Price for WooCommerce900+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )unit-price-for-woocommerce.php:1166 -
Color and Image Swatches for Variable Product Attributes900+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )plugin.php:188 -
Instantio700+ installs
do_action( 'woocommerce_ajax_added_to_cart', $child_id )includes/controller/App.php:476 -
Product Variation Swatches for WooCommerce700+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )src/Frontend/Frontend.php:934 -
bBlocks700+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product->get_id() )includes/blocks/woo-add-to-cart/WooAddToCart.php:939 -
Order Bump for WooCommerce600+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/hooks/bump/add-to-cart.php:26 -
Enhanced AJAX Add to Cart for WooCommerce600+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/class-eaa2c-ajax.php:97 -
Upzell Checkout Upsell Funnel for WooCommerce600+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/frontend/frontend.php:175 -
UltraAddons for Elementor600+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )inc/widget/product-list.php:3386 -
Product Table For WooCommerce500+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/class-awcpt-front-end.php:1056 -
Mini Cart for WooCommerce500+ installs
do_action( 'woocommerce_ajax_added_to_cart', intval($_POST['add-to-cart']) )public/frontend/class-whmc-fragments.php:68 -
JustTables500+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/ajax-actions.php:206 -
XT Variation Swatches for WooCommerce500+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )xt-framework/includes/modules/add-to-cart/module-add-to-cart.php:311 -
Leo Product Recommendations: Upsell Popup, Frequently Bought Together & Cart Drawer for WooCommerce400+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/class-ajax-add-to-cart.php:170 -
Quantity Discounts, Breaks & Product Bundles for Woocommerce By Bundler400+ installs
do_action( 'woocommerce_ajax_added_to_cart', $last_added_id )src/controllers/ajax.php:156 -
StoreBuild400+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )public/class-pure-wc-shopbuild-public.php:422 -
STAGGS400+ installs
do_action( 'woocommerce_ajax_added_to_cart', $cart_product_id )includes/woocommerce/class-staggs-cart.php:214 -
Product Table for WooCommerce400+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/class-mpc-add-to-cart.php:83 -
XT Quick View for WooCommerce300+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )xt-framework/includes/modules/add-to-cart/module-add-to-cart.php:295 -
Ajaxified Cart300+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/class-abwc-ajax-cart-loader.php:137 -
WPC Save For Later for WooCommerce300+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )wpc-save-for-later.php:490 -
Food Online for WooCommerce300+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )classes/class-fdoe-ajax.php:527 -
Floating Cart Product For WooCommerce300+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )main/frontend/fcpfw_rest.php:174 -
QuickSwish300+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/classes/Ajax.php:102 -
FoodBook Lite300+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )inc/class-products.php:450 -
Kickflip product configurators200+ installs
do_action( 'woocommerce_ajax_added_to_cart', $productId )src/Controller/MczrCartController.php:277 -
One Page Quick Checkout for WooCommerce200+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/ajaxhandler.php:596 -
Iute200+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )woocomerce-iutepay-gateway.php:367 -
NM Gift Registry and Wishlist Lite200+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/Lib/Order.php:709 -
Gift Message for WooCommerce200+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/class-gmfw-cart.php:35 -
Ni WooCommerce Product Variations Table100+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/ni-product-variations-table.php:168 -
Finest Floating Cart for WooCommerce100+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/functions.php:250 -
WPC Smart Upsell Funnel for WooCommerce100+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )wpc-smart-upsell-funnel.php:861 -
RestroFood Lite100+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )inc/class-products.php:452 -
TPure Variation Swatches for WooCommerce100+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )public/Frontend.php:213 -
Polski for WooCommerce90+ installs
do_action( 'woocommerce_ajax_added_to_cart', $productId )src/Service/AjaxAddToCartService.php:150 -
Printcart Store80+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/class.my.design.php:1324 -
Wholesale Order Table for WooCommerce70+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )classes/class-otfw-ajax.php:145 -
Nexvio for WooCommerce50+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/class-nexvio-showcase-ajax.php:46 -
wiseCampaign40+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/features/WiseProductTable.php:633 -
XT Points & Rewards for WooCommerce40+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )xt-framework/includes/modules/add-to-cart/module-add-to-cart.php:300 -
Productive Commerce40+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/common/product.php:32 -
Notifal40+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )app/Modules/Templates/Presentation/Frontend/Controllers/AjaxAddToCartController.php:145 -
ByNeural AI Assistant30+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/byneural-ai-assistants-cart.php:117 -
Pixel Clusters30+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )pixel-clusters.php:563 -
Pizza builder for WooCommerce30+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/pizza-ajax.php:107 -
Bargain Bot for WooCommerce30+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )wpbot-minimum-acceptable-price-variation.php:287 -
COMPE20+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )frontend/frontend.php:1792 -
User Post Collections20+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )controllers/mg-upc-woocommerce.php:763 -
XT Catalog Mode for WooCommerce20+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )xt-framework/includes/modules/add-to-cart/module-add-to-cart.php:300 -
DesignO10+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )class.designo-rest-api.php:1400 -
Variation Monster10+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )Inc/Frontend-ajax.php:1529 -
Novixa Addons for Elementor10+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )modules/product-carousel/class-product-carousel-engine.php:1423 -
Express Shop for WooCommerce Product Table10+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )qcld-express-ajax.php:114 -
VividWorks 3D E-Commerce Configurator10+ installs
do_action( 'woocommerce_ajax_added_to_cart', $composite_id )public/class-vwplume-public.php:709 -
QtyFlow10+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/class-ajax.php:80 -
DynamicBlocks10+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/frontend/class-main.php:449 -
Tb Product Designer for WooCommerce10+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )public/class-tb-product-designer-for-woocommerce-public.php:323 -
SaleDash10+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/api/class-w2w-rest-cart-controller.php:386 -
Advanced Add To Cart for WooCommerce10+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )advanced-add-to-cart.php:147 -
Restaurant for WooCommerce10+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )classes/ajax.php:377 -
Viral Buy for Me for WooCommerce Increase Sales10+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )inc/qcld-cross-sell-ajax.php:219 -
Peleman Webshop Plugin10+ installs
do_action( 'woocommerce_ajax_added_to_cart', $productId )publicPage/hookables/Ajax_Add_To_Cart.php:78 -
Idesoftbcn AI Product Customizer for WooCommerce10+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/plugin.php:1968 -
Simple Cart10+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/carts/class-woocommerce.php:41 -
Lootly Loyalty & Rewards10+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )classes/FreeProductCartBridge.php:105 -
Astro WooCommerce Free Gift10+ installs
do_action( 'woocommerce_ajax_added_to_cart', $gift_id )astro-woocommerce-free-gift.php:155 -
ThemesZone WooCommerce Ajax Quantity10+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )public/class-tz-wc-ajax-qty-public.php:172 -
Formula04 WooCommerce Quick Window10+ installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )formula04_quickwindow.php:892 -
Sell.AI StockFewer than 10 installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/class-frontend.php:478 -
VirtueFewer than 10 installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )public/class-virtue-woocommerce-public.php:316 -
NOW Campaign Storefronts for WooCommerceFewer than 10 installs
do_action( 'woocommerce_ajax_added_to_cart', absint( $addedItem['product_id'] ) )src/Cart/AjaxController.php:154 -
Et-woo-product-priceFewer than 10 installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )et-woo-product-price.php:170 -
Juwel Card Variation SwatchesFewer than 10 installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/class-cart.php:77 -
RockOn Woo Variations TableFewer than 10 installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/class-rwvt-ajax.php:283 -
Addonn Variant Grid for WooCommerceFewer than 10 installs
do_action( 'woocommerce_ajax_added_to_cart', $parent_id )includes/modules/cards/class-adnvg-cart-ajax.php:52 -
ReservingFewer than 10 installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )app/extensions/frontend/ajax/Ajax.php:60 -
Awesome Quick Viewer for WooCommerce LiteFewer than 10 installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )plugin.php:144 -
Fine MCPFewer than 10 installs
do_action( 'woocommerce_ajax_added_to_cart', $id )includes/woo-new-widgets-ajax.php:186 -
OneTrace for WooCommerceFewer than 10 installs
do_action( 'woocommerce_ajax_added_to_cart', $productId )src/SearchWidget.php:227 -
Leo Review Video Popup for WooCommerceFewer than 10 installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )src/Frontend/CartHandler.php:66 -
Swift CommerceFewer than 10 installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/class-added-to-cart-popup.php:694 -
SMT Toolkit for WooCommerceFewer than 10 installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/modules/ajax-archive/class-ajax-archive-frontend.php:969 -
CompleteGreetFewer than 10 installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/class-shoppable.php:123 -
StoreMindFewer than 10 installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )storemind.php:689 -
ZorachatFewer than 10 installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/rest/chat.php:2377 -
Quick Cart ShoppingFewer than 10 installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )apps/FrontEnd/Cart/AddToCartHandler.php:54 -
WPFIA QuickCart for WooCommerceFewer than 10 installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/class-quickcart-ajax.php:89 -
IPS Cart&Checkout for WooCommerceFewer than 10 installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/classes/Front/Sidecart/SidecartAddToCart.php:81 -
AvoFewer than 10 installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/class-avoaisha-rest-controller.php:300 -
Nanflows Sliding CartFewer than 10 installs
do_action( 'woocommerce_ajax_added_to_cart', $parent_id )includes/class-ajax.php:273 -
Brandora Product Brand Pages for ElementorFewer than 10 installs
do_action( 'woocommerce_ajax_added_to_cart', $pid )includes/landing/class-zbel-lp-data.php:799 -
Reycob Visual Product FiltersFewer than 10 installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/class-cfv-purchase-controls.php:210 -
REYCOB Shop the LookFewer than 10 installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )reycob-shop-the-look.php:667 -
Plattio SearchFewer than 10 installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )plattio-search.php:1340 -
Qentrox Bulk Variation Grid for WooCommerceFewer than 10 installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/class-ajax-handler.php:47 -
YeeMenuFewer than 10 installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/class-yeemenu-init.php:1283 -
800Website Loyalty Rewards for WooCommerceFewer than 10 installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )800website-loyalty-rewards.php:1412 -
Advanced Wishlist & ShareFewer than 10 installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/public/inc/advwl-functions.php:627 -
Gift Message for WooFewer than 10 installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )gift-message-for-woo.php:646 -
Ajax instant buy checkout for WooCommerceFewer than 10 installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )woo-ajax-instant-checkout.php:292 -
Smart Cart for WooCommerceFewer than 10 installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/features/cart-api/trait-item-actions.php:58 -
ShopXpertFewer than 10 installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )incs/features/wishlist/incs/classes/Ajax.php:172 -
SamplyFewer than 10 installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/functions.php:151 -
Single Page ShoppingFewer than 10 installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/class-awcs-wc-cart-actions.php:55 -
Invoice management for WoocommerceFewer than 10 installs
do_action( 'woocommerce_ajax_added_to_cart', $product_id )includes/class-wc-ajax.php:424
Need a customisation built on this hook?
Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.