Automattic\WooCommerce\StoreApi\Schemas\V1
ProductAttributeSchema::get_item_response
Convert an attribute object into an object suitable for the response.
Method of the class: ProductAttributeSchema{}
No Hooks.
Returns
Array.
Usage
$ProductAttributeSchema = new ProductAttributeSchema(); $ProductAttributeSchema->get_item_response( $attribute );
- $attribute(object) (required)
- Attribute object.
ProductAttributeSchema::get_item_response() ProductAttributeSchema::get item response code WC 10.3.3
public function get_item_response( $attribute ) {
return [
'id' => (int) $attribute->id,
'name' => $this->prepare_html_response( $attribute->name ),
'taxonomy' => $attribute->slug,
'type' => $attribute->type,
'order' => $attribute->order_by,
'has_archives' => $attribute->has_archives,
'count' => (int) \wp_count_terms( $attribute->slug ),
];
}