Option extends Model Uses HasUniqueIdentifier
Representation of an individual group and it's options.
Tags
Table of Contents
- $fillable : array<string|int, mixed>
- Fields which can be mass assigned.
- $timestamps : mixed
- $attributes : array<string|int, mixed>
- Defaults
- $casts : array<string|int, mixed>
- Automatically cast attributes in specific ways.
- $primaryKey : mixed
- $table : mixed
- clean_option_data() : mixed
- formula_includes_product_quantity() : bool
- Whether the price formula includes the [product_quantity]
- get_image_options_for_gallery() : array<string|int, mixed>
- Retrieve the image IDs to be used in the product gallery.
- get_missing_attribute_options() : mixed
- Retrieve all custom attribute options for the given attribute, which do not have a choice set for the given term.
- get_price_suffixes_by_product() : string|null
- Retrieve the first available price suffix on the product.
- get_product_choices_images() : mixed
- get_product_custom_attribute_options() : array<string|int, mixed>
- Retrieve the custom attribute options for the product.
- get_product_price_exclusion_status() : bool
- Determine if the product price should be excluded from the calculation.
- type_supports_property() : mixed
Properties
$fillable
Fields which can be mass assigned.
public
array<string|int, mixed>
$fillable
= ['name', 'group_id', 'menu_order', 'display_name', 'description', 'required', 'type', 'choices', 'settings', 'conditional_logic']
Tags
$timestamps
public
mixed
$timestamps
= false
Tags
$attributes
Defaults
protected
array<string|int, mixed>
$attributes
= ['name' => '', 'group_id' => 0, 'menu_order' => 0, 'display_name' => 1, 'description' => '', 'required' => 0, 'type' => 'text', 'choices' => 'null', 'settings' => 'null', 'conditional_logic' => 'null']
Tags
$casts
Automatically cast attributes in specific ways.
protected
array<string|int, mixed>
$casts
= ['choices' => 'array', 'settings' => 'array', 'conditional_logic' => 'array']
Tags
$primaryKey
protected
mixed
$primaryKey
= 'id'
Tags
$table
protected
mixed
$table
= \Barn2\Plugin\WC_Product_Options\Plugin::META_PREFIX . 'options'
Tags
Methods
clean_option_data()
public
static clean_option_data(mixed $data) : mixed
Parameters
- $data : mixed
Tags
Return values
mixed —formula_includes_product_quantity()
Whether the price formula includes the [product_quantity]
public
static formula_includes_product_quantity(int $option_id) : bool
Parameters
- $option_id : int
Tags
Return values
bool —get_image_options_for_gallery()
Retrieve the image IDs to be used in the product gallery.
public
static get_image_options_for_gallery(WC_Product $product) : array<string|int, mixed>
Parameters
- $product : WC_Product
Tags
Return values
array<string|int, mixed> —get_missing_attribute_options()
Retrieve all custom attribute options for the given attribute, which do not have a choice set for the given term.
public
static get_missing_attribute_options(mixed $attribute, mixed $term_id) : mixed
Parameters
- $attribute : mixed
- $term_id : mixed
Tags
Return values
mixed —get_price_suffixes_by_product()
Retrieve the first available price suffix on the product.
public
static get_price_suffixes_by_product(WC_Product $product) : string|null
Parameters
- $product : WC_Product
Tags
Return values
string|null —get_product_choices_images()
public
static get_product_choices_images(mixed $option, mixed $product) : mixed
Parameters
- $option : mixed
- $product : mixed
Tags
Return values
mixed —get_product_custom_attribute_options()
Retrieve the custom attribute options for the product.
public
static get_product_custom_attribute_options(WC_Product $product) : array<string|int, mixed>
Parameters
- $product : WC_Product
Tags
Return values
array<string|int, mixed> —get_product_price_exclusion_status()
Determine if the product price should be excluded from the calculation.
public
static get_product_price_exclusion_status(WC_Product $product) : bool
Parameters
- $product : WC_Product
Tags
Return values
bool —type_supports_property()
public
static type_supports_property(mixed $property, mixed $type) : mixed
Parameters
- $property : mixed
- $type : mixed