woocommerce_(producttype)_add_to_cart
Trigger the single product add to cart action for each product type.
Usage
add_action( 'woocommerce_(producttype)_add_to_cart', 'wp_kama_woocommerce_producttype_add_to_cart_action' ); /** * Function for `woocommerce_(producttype)_add_to_cart` action-hook. * * @return void */ function wp_kama_woocommerce_producttype_add_to_cart_action(){ // action... }
Changelog
Since 9.7.0 | Introduced. |
Where the hook is called
woocommerce_(producttype)_add_to_cart
woocommerce_(producttype)_add_to_cart
woocommerce/packages/woocommerce-blocks/src/BlockTypes/AddToCartForm.php 83
do_action( 'woocommerce_' . $product->get_type() . '_add_to_cart' );
woocommerce/includes/wc-template-functions.php 1702
do_action( 'woocommerce_' . $product->get_type() . '_add_to_cart' );
Where the hook is used in WooCommerce
woocommerce/includes/wc-template-hooks.php 176
add_action( 'woocommerce_simple_add_to_cart', 'woocommerce_simple_add_to_cart', 30 );
woocommerce/includes/wc-template-hooks.php 177
add_action( 'woocommerce_grouped_add_to_cart', 'woocommerce_grouped_add_to_cart', 30 );
woocommerce/includes/wc-template-hooks.php 178
add_action( 'woocommerce_variable_add_to_cart', 'woocommerce_variable_add_to_cart', 30 );
woocommerce/includes/wc-template-hooks.php 179
add_action( 'woocommerce_external_add_to_cart', 'woocommerce_external_add_to_cart', 30 );