wc_get_stock_html( WC_Product $product )
Get HTML to show product stock.
Description Description
Parameters Parameters
- $product
-
(Required) Product Object.
Return Return
(string)
Source Source
File: includes/wc-template-functions.php
function wc_get_stock_html( $product ) { $html = ''; $availability = $product->get_availability(); if ( ! empty( $availability['availability'] ) ) { ob_start(); wc_get_template( 'single-product/stock.php', array( 'product' => $product, 'class' => $availability['class'], 'availability' => $availability['availability'], ) ); $html = ob_get_clean(); } if ( has_filter( 'woocommerce_stock_html' ) ) { wc_deprecated_function( 'The woocommerce_stock_html filter', '', 'woocommerce_get_stock_html' ); $html = apply_filters( 'woocommerce_stock_html', $html, $availability['availability'], $product ); } return apply_filters( 'woocommerce_get_stock_html', $html, $product ); }
Changelog Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |