WooCommerce Code Reference

WC_Product_Attribute
in package
implements ArrayAccess

Product attribute class.

Interfaces, Classes and Traits

ArrayAccess

Table of Contents

$data  : array<string|int, mixed>
Data array.
get_data()  : array<string|int, mixed>
Returns all data for this object.
get_id()  : int
Get the ID.
get_name()  : string
Get name.
get_options()  : array<string|int, mixed>
Get options.
get_position()  : int
Get position.
get_slugs()  : array<string|int, mixed>
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<string|int, mixed>|null
Get taxonomy object.
get_terms()  : array<string|int, mixed>|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<string|int, mixed> $data = array('id' => 0, 'name' => '', 'options' => array(), 'position' => 0, 'visible' => alse, 'variation' => alse)
Tags
since
3.0.0

Methods

get_slugs()

Gets slugs from the stored options, or just the string if text based.

public get_slugs() : array<string|int, mixed>
Return values
array<string|int, mixed>

get_taxonomy_object()

Get taxonomy object.

public get_taxonomy_object() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null

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(string $value) : mixed
Parameters
$value : string

Attribute name.

Return values
mixed

set_options()

Set options.

public set_options(array<string|int, mixed> $value) : mixed
Parameters
$value : array<string|int, mixed>

Attribute options.

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