WC_Order_Item::get_cogs_value
Get the value of the Cost of Goods Sold for this order item.
WARNING! If the Cost of Goods Sold feature is disabled this method will always return zero.
Method of the class: WC_Order_Item{}
No Hooks.
Returns
float. The current value for this order item.
Usage
$WC_Order_Item = new WC_Order_Item(); $WC_Order_Item->get_cogs_value( $context ): float;
- $context(string)
- What the value is for. Valid values are view and edit.
Default:'view'
WC_Order_Item::get_cogs_value() WC Order Item::get cogs value code WC 10.6.2
public function get_cogs_value( $context = 'view' ): float {
return (float) ( $this->has_cogs() && $this->cogs_is_enabled( __METHOD__ ) ? $this->get_prop( 'cogs_value', $context ) : 0 );
}