WC_Product_Variation_Data_Store_CPT::load_cogs_data()
Load the Cost of Goods Sold related data for a given product.
Method of the class: WC_Product_Variation_Data_Store_CPT{}
Hooks from the method
Return
null
. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->load_cogs_data( $product );
- $product(WC_Product) (required)
- The product to apply the loaded data to.
WC_Product_Variation_Data_Store_CPT::load_cogs_data() WC Product Variation Data Store CPT::load cogs data code WC 9.5.1
protected function load_cogs_data( $product ) { parent::load_cogs_data( $product ); $cogs_value_overrides_parent = 'yes' === get_post_meta( $product->get_id(), '_cogs_value_overrides_parent', true ); /** * Filter to customize the "Cost of Goods Sold value overrides the parent value" flag that gets loaded for a given variable product. * * @since 9.5.0 * * @param bool $cogs_value_overrides_parent The flag as read from the database. * @param WC_Product $product The product for which the flag is being loaded. */ $cogs_value_overrides_parent = apply_filters( 'woocommerce_load_product_cogs_overrides_parent_value_flag', $cogs_value_overrides_parent, $product ); $product->set_props( array( 'cogs_value_overrides_parent' => $cogs_value_overrides_parent, ) ); }