woocommerce_add_to_cart_qty_html
Filters the quantity HTML for the add to cart message.
Usage
add_filter( 'woocommerce_add_to_cart_qty_html', 'wp_kama_woocommerce_add_to_cart_qty_html_filter', 10, 2 );
/**
* Function for `woocommerce_add_to_cart_qty_html` filter-hook.
*
* @param string $qty_html The quantity HTML.
* @param int $product_id The product ID.
*
* @return string
*/
function wp_kama_woocommerce_add_to_cart_qty_html_filter( $qty_html, $product_id ){
// filter...
return $qty_html;
}
- $qty_html(string)
- The quantity HTML.
- $product_id(int)
- The product ID.
Changelog
| Since 2.6.1 | Introduced. |
Where the hook is called
woocommerce_add_to_cart_qty_html
woocommerce/includes/wc-cart-functions.php 98
$title = apply_filters( 'woocommerce_add_to_cart_qty_html', ( 1 !== $qty ? wc_stock_amount( $qty ) . ' × ' : '' ), $product_id );