WC_AJAX::base_cost_or_nullprivate staticWC 1.0

Get the Cost of Goods Sold value for a product (0 if it's null), return null if the Cost of Goods Sold feature is disabled.

Метод класса: WC_AJAX{}

Хуков нет.

Возвращает

float|null. Cost of the product, or null.

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

$result = WC_AJAX::base_cost_or_null( $product_object ): ?float;
$product_object(WC_Product) (обязательный)
Product object.

Код WC_AJAX::base_cost_or_null() WC 9.9.4

private static function base_cost_or_null( WC_Product $product_object ): ?float {
	return wc_get_container()->get( CostOfGoodsSoldController::class )->feature_is_enabled() ? ( $product_object->get_cogs_value() ?? 0 ) : null;
}