WordPress filter hook
woocommerce_stock_html
Defined by WooCommerce and fired by 17 plugins in total, running on 7.7M+ sites between them.
How to use woocommerce_stock_html
It's a filter: your callback receives the value and 2 more arguments, and must return the (changed) value.
Add this to your theme's functions.php or a small custom plugin:
add_filter( 'woocommerce_stock_html', function( $stock_html, $kses_post, $product ) {
// Change $stock_html here.
return $stock_html;
}, 10, 3 );Argument names come from Royal Addons for Elementor's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
17 plugins that fire woocommerce_stock_html
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
WooCommerce7+ million installs
apply_filters( 'woocommerce_stock_html', $html, $availability['availability'], $product )includes/wc-template-functions.php:4364 -
Royal Addons for Elementor600,000+ installs
apply_filters( 'woocommerce_stock_html', $stock_html, wp_kses_post($availability['availability']), $product )modules/theme-builder/woocommerce/product-stock/widgets/wpr-product-stock.php:409 -
ShopEngine90,000+ installs
apply_filters( 'woocommerce_stock_html', $stock_html, $availability_html, $product )widgets/product-stock/screens/default.php:113 -
Spexo Addons for Elementor6,000+ installs
apply_filters( 'woocommerce_stock_html', $stock_html, wp_kses_post($availability['availability']), $product )inc/widgets/woo-product-stock.php:449 -
WowStore4,000+ installs
apply_filters( 'woocommerce_stock_html', $stock_html, $availability['availability'], $product )blocks/woo/Product_Stock.php:55 -
ShopEngine Gutenberg WooCommerce Builder Blocks Addon3,000+ installs
apply_filters( 'woocommerce_stock_html', $stock_html, wp_kses_post($availability['availability']), $product )blocks/product-stock/screen.php:66 -
Products Compare for WooCommerce1,000+ installs
apply_filters( 'woocommerce_stock_html', $availability_html, $term['availability']['availability'], $product )templates/new-compare.php:413 -
CRT Addons Builder and Widgets for Elementor300+ installs
apply_filters( 'woocommerce_stock_html', $stock_html ?? '', $availability['availability'] ?? '', $product )includes/customizer/addons/modules/woocommerce/crt-product-stock.php:405 -
Salevo Boost Sales for WooCommerce200+ installs
apply_filters( 'woocommerce_stock_html', $availability_html, $availability['availability'], $product )templates/single-product/add-to-cart/wbs-bundle.php:22 -
Wishlist and Waitlist for WooCommerce100+ installs
apply_filters( 'woocommerce_stock_html', $availability_html, $term['availability']['availability'], $product )includes/functions.php:22 -
ShopMaker90+ installs
apply_filters( 'woocommerce_stock_html', $availability_html, $availability['availability'], $wc_product )classes/widgets/wishlist/sm-wishlist-products.php:599 -
Wholesale Order Table for WooCommerce70+ installs
apply_filters( 'woocommerce_stock_html', $availability_html, $availability['availability'], $product )classes/class-otfw-product.php:777 -
Reactor: Core30+ installs
apply_filters( 'woocommerce_stock_html', $availability_html, $availability['availability'], $product )inc/api/v1/templates/woo/add-to-cart/grouped.php:53 -
Elite Elementor Addons and Widgets20+ installs
apply_filters( 'woocommerce_stock_html', $stock_html, wp_kses_post($availability['availability']), $product )modules/theme-builder/woocommerce/product-stock/widgets/elite-product-stock.php:409 -
WooLayout10+ installs
apply_filters( 'woocommerce_stock_html', $availability_html, $availability['availability'], $product )lib/woolayout/single-product/add-to-cart/grouped.php:80 -
Products Wizard Lite for WooCommerce10+ installs
apply_filters( 'woocommerce_stock_html', $availabilityHtml, $availability['availability'], $this->product )includes/classes/Instances/FormProduct.php:179 -
RedQ Events10+ installs
apply_filters( 'woocommerce_stock_html', '<p class="stock ' . esc_attr( $availability['class'] ) . '">' . esc_html( $availability['availability'] ) . '</p>', $availability['availability'] )templates/single-product/add-to-cart/event.php:29
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.