Automattic\WooCommerce\StoreApi\Schemas\V1
ProductSchema::prepare_product_attribute_value
Prepare an attribute term for the response.
Method of the class: ProductSchema{}
No Hooks.
Returns
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() ProductSchema::prepare product attribute value code WC 10.8.1
protected function prepare_product_attribute_value( $name, $id = 0, $slug = '' ) {
return (object) [
'id' => (int) $id,
'name' => $name,
'slug' => $slug ? $slug : $name,
];
}