ProductItemTrait
ProductItemTrait
Shared functionality for formating product item data.
Table of Contents
- format_variation_data() : array<string|int, mixed>
- Format variation data, for example convert slugs such as attribute_pa_size to Size.
- prepare_product_price_response() : array<string|int, mixed>
- Get an array of pricing data.
Methods
format_variation_data()
Format variation data, for example convert slugs such as attribute_pa_size to Size.
protected
format_variation_data(array<string|int, mixed> $variation_data, WC_Product $product) : array<string|int, mixed>
Parameters
- $variation_data : array<string|int, mixed>
-
Array of data from the cart.
- $product : WC_Product
-
Product data.
Return values
array<string|int, mixed> —prepare_product_price_response()
Get an array of pricing data.
protected
prepare_product_price_response(WC_Product $product[, string $tax_display_mode = '' ]) : array<string|int, mixed>
Parameters
- $product : WC_Product
-
Product instance.
- $tax_display_mode : string = ''
-
If returned prices are incl or excl of tax.