WC_Product::get_cogs_valuepublicWC 1.0

Get the defined value of the Cost of Goods Sold for this product. See set_cogs_value.

WARNING! If the Cost of Goods Sold feature is disabled this method will always return null.

Method of the class: WC_Product{}

No Hooks.

Returns

float. The current value for this product.

Usage

$WC_Product = new WC_Product();
$WC_Product->get_cogs_value(): ?float;

WC_Product::get_cogs_value() code WC 10.3.6

public function get_cogs_value(): ?float {
	if ( ! $this->cogs_is_enabled( __METHOD__ ) ) {
		return null;
	}

	$value = $this->get_prop( 'cogs_value' );
	return is_null( $value ) ? null : (float) $value;
}