Méthode |
Description |
|
__construct ( integer | WC_Product | object $product ) |
Merges variable product data into the parent object. |
|
add_to_cart_text ( ) : string |
Get the add to cart button text. |
|
child_has_dimensions ( ) : boolean |
Does a child have dimensions set? |
|
child_has_weight ( ) : boolean |
Does a child have a weight set? |
|
child_is_in_stock ( ) : boolean |
Is a child in stock? |
|
get_available_variation ( WC_Product $variation ) : array |
Returns an array of data for a variation. Used in the add to cart form. |
|
get_available_variations ( ) : array |
Get an array of available variations for the current product. |
|
get_children ( string $context = 'view' ) : array |
Return a products child ids. |
|
get_downloadable ( $context = 'view' ) |
Variable products themselves cannot be downloadable. |
|
get_price_html ( string $price = '' ) : string |
Returns the price in html format. |
|
get_type ( ) : string |
Get internal type. |
|
get_variation_attributes ( string $context = 'view' ) : array |
Return an array of attributes used for variations, as well as their possible values. |
|
get_variation_default_attribute ( string $attribute_name ) : string |
If set, get the default attributes for a variable product. |
|
get_variation_price ( string $min_or_max = 'min', boolean $include_taxes = false ) : string |
Get the min or max variation (active) price. |
|
get_variation_prices ( string $context = 'view' ) : array() |
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. |
|
get_variation_prices_including_taxes ( string $context = 'view' ) : array() |
Get an array of all sale and regular prices from all variations, includes taxes. |
|
get_variation_regular_price ( string $min_or_max = 'min', boolean $include_taxes = false ) : string |
Get the min or max variation regular price. |
|
get_variation_sale_price ( string $min_or_max = 'min', boolean $include_taxes = false ) : string |
Get the min or max variation sale price. |
|
get_virtual ( $context = 'view' ) |
Variable products themselves cannot be virtual. |
|
get_visible_children ( string $context = 'view' ) : array |
Return a products child ids - visible only. |
|
has_dimensions ( ) : boolean |
Returns whether or not the product has dimensions set. |
|
has_weight ( ) : boolean |
Returns whether or not the product has weight set. |
|
is_on_sale ( ) : boolean |
Returns whether or not the product is on sale. |
|
save ( ) |
Save data (either create or update depending on if we are working on an existing product). |
|
set_children ( $children ) |
Sets an array of children for the product. |
|
set_variation_attributes ( $variation_attributes ) |
Sets an array of variation attributes |
|
set_variation_prices ( $variation_prices ) |
Sets an array of variation prices. |
|
set_variation_prices_including_taxes ( $variation_prices_including_taxes ) |
Sets an array of variation prices, including taxes. |
|
set_visible_children ( $visible_children ) |
Sets an array of visible children only. |
|
sync ( WC_Product | integer $product, boolean $save = true ) : WC_Product |
Sync a variable product with it's children. These sync functions sync
upwards (from child to parent) when the variation is saved. |
|
sync_stock_status ( WC_Product | integer $product, boolean $save = true ) : WC_Product |
Sync parent stock status with the status of all children and save. |
|
validate_props ( ) |
Ensure properties are set correctly before save. |
|