WooCommerce Code Reference

WC_Product_Attribute
in package
implements ArrayAccess

Product attribute class.

Interfaces, Classes and Traits

ArrayAccess

Table of Contents

$data  : array
Data array.
get_data()  : array
Returns all data for this object.
get_id()  : int
Get the ID.
get_name()  : string
Get name.
get_options()  : array
Get options.
get_position()  : int
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()  : bool
Get if variation.
get_visible()  : bool
Get if visible.
is_taxonomy()  : bool
Return if this attribute is a taxonomy.
offsetExists()  : bool
OffsetExists.
offsetGet()  : mixed
OffsetGet.
offsetSet()  : mixed
OffsetSet.
offsetUnset()  : mixed
OffsetUnset.
set_id()  : mixed
Set ID (this is the attribute ID).
set_name()  : mixed
Set name (this is the attribute name or taxonomy).
set_options()  : mixed
Set options.
set_position()  : mixed
Set position.
set_variation()  : mixed
Set if variation.
set_visible()  : mixed
Set if visible.

Properties

$data

Data array.

protected array $data = array('id' => 0, 'name' => '', 'options' => array(), 'position' => 0, 'visible' => alse, 'variation' => alse)
Tags
since
3.0.0

Methods

offsetSet()

OffsetSet.

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

Offset.

$value : mixed

Value.

Return values
mixed

set_name()

Set name (this is the attribute name or taxonomy).

public set_name(int $value) : mixed
Parameters
$value : int

Attribute name.

Return values
mixed

set_variation()

Set if variation.

public set_variation(bool $value) : mixed
Parameters
$value : bool

If is used for variations.

Return values
mixed

set_visible()

Set if visible.

public set_visible(bool $value) : mixed
Parameters
$value : bool

If is visible on Product's additional info tab.

Return values
mixed