WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

wc_get_low_stock_amount() WC 3.5.0

Return low stock amount to determine if notification needs to be sent

Since 5.2.0, this function no longer redirects from variation to its parent product. Low stock amount can now be attached to the variation itself and if it isn't, only then we check the parent product, and if it's not there, then we take the default from the store-wide setting.

Хуков нет.

Возвращает

int.

Использование

wc_get_low_stock_amount( $product );
$product(WC_Product) (обязательный)
Product to get data from.

Список изменений

С версии 3.5.0 Введена.

Код wc_get_low_stock_amount() WC 5.6.0

function wc_get_low_stock_amount( WC_Product $product ) {
	$low_stock_amount = $product->get_low_stock_amount();

	if ( '' === $low_stock_amount && $product->is_type( 'variation' ) ) {
		$product          = wc_get_product( $product->get_parent_id() );
		$low_stock_amount = $product->get_low_stock_amount();
	}

	if ( '' === $low_stock_amount ) {
		$low_stock_amount = get_option( 'woocommerce_notify_low_stock_amount', 2 );
	}

	return (int) $low_stock_amount;
}