wc_get_stock_html() WC 3.0.0
Get HTML to show product stock.
Хуки из функции
Возвращает
Строку.
Использование
wc_get_stock_html( $product );
- $product(WC_Product) (обязательный)
- Product Object.
Список изменений
С версии 3.0.0 | Введена. |
Код wc_get_stock_html() wc get stock html WC 5.0.0
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 );
}