Automattic\WooCommerce\StoreApi\Schemas\V1

ProductSchema::prepare_product_attribute_value()protectedWC 1.0

Prepare an attribute term for the response.

Method of the class: ProductSchema{}

No Hooks.

Return

Object.

Usage

// protected - for code of main (parent) or child class
$result = $this->prepare_product_attribute_value( $name, $id, $slug );
$name(string) (required)
Attribute term name.
$id(int)
Attribute term ID.
$slug(string)
Attribute term slug.
Default: ''

ProductSchema::prepare_product_attribute_value() code WC 8.7.0

protected function prepare_product_attribute_value( $name, $id = 0, $slug = '' ) {
	return (object) [
		'id'   => (int) $id,
		'name' => $name,
		'slug' => $slug ? $slug : $name,
	];
}