woocommerce_(producttype)_add_to_cart хук-событиеWC 1.0

Trigger the single product add to cart action.

Использование

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...
}

Где вызывается хук

woocommerce_template_single_add_to_cart()
woocommerce_(producttype)_add_to_cart
woocommerce/includes/wc-template-functions.php 1687
do_action( 'woocommerce_' . $product->get_type() . '_add_to_cart' );

Где используется хук в 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 );