تابع ووکامرسی wc_get_stock_html نمایش کد html موجودی محصول

تابع ووکامرسی wc_get_stock_html – نمایش کد html موجودی محصول ( کالا )
Syntax – سینتکس
(string) wc_get_stock_html( (WC_Product) $product );
Parameters – پارامتر ها (1)
- 1- $product (WC_Product)
Usage – نحوه استفاده
if ( !function_exists( 'wc_get_stock_html' ) ) {
require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-template-functions.php';
}
// The product.
$product = null;
// NOTICE! Understand what this does before running.
$result = wc_get_stock_html($product);
Defined – محل تعریف
/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 );
}
versions – نسخه ها
از نسخه : 3.0.0
نسخه فعلی : 3.0.6
دیگر نسخه ها : 3.0.6 , 3.0.5 , 3.0.4 , 3.0.3 , 3.0.2
ارسال نظر