Automattic\WooCommerce\Internal\ProductFeed\Mapping
UcpProductMapper::item
Build the Store API item response for a product or variation, as nested arrays.
Method of the class: UcpProductMapper{}
No Hooks.
Returns
array.
Usage
// private - for code of main (parent) class only $result = $this->item( $product ): array;
- $product(WC_Product) (required)
- WooCommerce product.
UcpProductMapper::item() UcpProductMapper::item code WC 11.3.0
private function item( \WC_Product $product ): array {
// Nested values are stdClass; decode through JSON for uniform array access.
return (array) json_decode( (string) wp_json_encode( $this->schema()->get_item_response( $product ) ), true );
}