PHP Class WC_Product_Variable_Data_Store_CPT

Author: WooThemes
Inheritance: extends WC_Product_Data_Store_CPT, implements WC_Object_Data_Store_Interface, implements WC_Product_Variable_Data_Store_Interface
Show file Open project: woocommerce/woocommerce

Public Methods

Method Description
child_has_dimensions ( $product ) : boolean Does a child have dimensions set?
child_has_weight ( $product ) : boolean Does a child have a weight set?
child_is_in_stock ( $product ) : boolean Is a child in stock?
read_children ( &$product, boolean $force_read = false ) : WC_Product Loads variation child IDs.
sync_managed_variation_stock_status ( &$product ) Stock managed at the parent level - update children being managed by this product.
sync_price ( WC_Product | integer &$product ) Sync variable product prices with children.
sync_stock_status ( WC_Product | integer &$product ) Sync variable product stock status with children.

Protected Methods

Method Description
read_product_data ( &$product ) Read product data.

Private Methods

Method Description
read_price_data ( &$product, boolean $include_taxes = false ) Get an array of all sale and regular prices from all variations. This is used for example when displaying the price range at variable product level or seeing if the variable product is on sale.
read_variation_attributes ( &$product ) Loads an array of attributes used for variations, as well as their possible values.

Method Details

child_has_dimensions() public method

Does a child have dimensions set?
Since: 2.7.0
public child_has_dimensions ( $product ) : boolean
return boolean

child_has_weight() public method

Does a child have a weight set?
Since: 2.7.0
public child_has_weight ( $product ) : boolean
return boolean

child_is_in_stock() public method

Is a child in stock?
Since: 2.7.0
public child_is_in_stock ( $product ) : boolean
return boolean

read_children() public method

Loads variation child IDs.
public read_children ( &$product, boolean $force_read = false ) : WC_Product
$force_read boolean True to bypass the transient.
return WC_Product

read_product_data() protected method

Read product data.
Since: 2.7.0
protected read_product_data ( &$product )

sync_managed_variation_stock_status() public method

This sync function syncs downwards (from parent to child) when the variable product is saved.
Since: 2.7.0

sync_price() public method

Sync variable product prices with children.
Since: 2.7.0
public sync_price ( WC_Product | integer &$product )
$product WC_Product | integer

sync_stock_status() public method

Change does not persist unless saved by caller.
Since: 2.7.0
public sync_stock_status ( WC_Product | integer &$product )
$product WC_Product | integer