PHP Class WC_Product_Attribute

Attributes can be global (taxonomy based) or local to the product itself. Uses ArrayAccess to be BW compatible with previous ways of reading attributes.
Since: 2.7.0
Author: WooThemes
Inheritance: implements ArrayAccess
Mostra file Open project: woocommerce/woocommerce Class Usage Examples

Protected Properties

Property Type Description
$data array Data array.

Public Methods

Method Description
get_data ( ) : array Returns all data for this object.
get_id ( ) : integer Get the ID.
get_name ( ) : integer Get name.
get_options ( ) : array Get options.
get_position ( ) : integer Get position.
get_slugs ( ) : array Gets slugs from the stored options, or just the string if text based.
get_taxonomy ( ) : string Get taxonomy name if applicable.
get_taxonomy_object ( ) : array | null Get taxonomy object.
get_terms ( ) : array | null Gets terms from the stored options.
get_variation ( ) : boolean Get if variation.
get_visible ( ) : boolean Get if visible.
is_taxonomy ( ) : boolean Return if this attribute is a taxonomy.
offsetExists ( string $offset ) : boolean offsetExists
offsetGet ( string $offset ) : mixed offsetGet
offsetSet ( string $offset, mixed $value ) offsetSet
offsetUnset ( string $offset ) offsetUnset
set_id ( integer $value ) Set ID (this is the attribute ID).
set_name ( integer $value ) Set name (this is the attribute name or taxonomy).
set_options ( array $value ) Set options.
set_position ( integer $value ) Set position.
set_variation ( boolean $value ) Set if variation.
set_visible ( boolean $value ) Set if visible.

Method Details

get_data() public method

Returns all data for this object.
public get_data ( ) : array
return array

get_id() public method

Get the ID.
public get_id ( ) : integer
return integer

get_name() public method

Get name.
public get_name ( ) : integer
return integer

get_options() public method

Get options.
public get_options ( ) : array
return array

get_position() public method

Get position.
public get_position ( ) : integer
return integer

get_slugs() public method

Gets slugs from the stored options, or just the string if text based.
public get_slugs ( ) : array
return array

get_taxonomy() public method

Get taxonomy name if applicable.
public get_taxonomy ( ) : string
return string

get_taxonomy_object() public method

Get taxonomy object.
public get_taxonomy_object ( ) : array | null
return array | null

get_terms() public method

Gets terms from the stored options.
public get_terms ( ) : array | null
return array | null

get_variation() public method

Get if variation.
public get_variation ( ) : boolean
return boolean

get_visible() public method

Get if visible.
public get_visible ( ) : boolean
return boolean

is_taxonomy() public method

Return if this attribute is a taxonomy.
public is_taxonomy ( ) : boolean
return boolean

offsetExists() public method

offsetExists
public offsetExists ( string $offset ) : boolean
$offset string
return boolean

offsetGet() public method

offsetGet
public offsetGet ( string $offset ) : mixed
$offset string
return mixed

offsetSet() public method

offsetSet
public offsetSet ( string $offset, mixed $value )
$offset string
$value mixed

offsetUnset() public method

offsetUnset
public offsetUnset ( string $offset )
$offset string

set_id() public method

Set ID (this is the attribute ID).
public set_id ( integer $value )
$value integer

set_name() public method

Set name (this is the attribute name or taxonomy).
public set_name ( integer $value )
$value integer

set_options() public method

Set options.
public set_options ( array $value )
$value array

set_position() public method

Set position.
public set_position ( integer $value )
$value integer

set_variation() public method

Set if variation.
public set_variation ( boolean $value )
$value boolean

set_visible() public method

Set if visible.
public set_visible ( boolean $value )
$value boolean

Property Details

$data protected_oe property

Data array.
Since: 2.7.0
protected array $data
return array