Hi HikaShop team,
We are customizing the checkout cart template (show_block_cart.php) to display each product option and cart item field as a separate line in the cart summary table, with individual unit price, quantity, and total columns.
While implementing this, we found that cart item fields (stored in $cart->cart_products[$i]->field_namekey) lack some metadata that would be essential for correct display:
1. No tax rate available for item fields
The field value stored in the cart item is the price excluding tax (e.g. 42.975), but there is no associated tax rate or tax category accessible from the template. We had to hardcode × 1.21 (21% VAT) because it happened to match the configured tax for that service. If a field uses a different tax rate (10%, 4%, etc.), the displayed price with tax will be wrong.
Suggested improvement: Include the tax rate or computed price_value_with_tax alongside the raw field value in the cart item data, similar to how prices[0]->price_value_with_tax is available for product options.
2. No indication of whether a field price scales with quantity
Some item fields represent a per-unit cost (should multiply by cart quantity), while others represent a flat one-time service fee (should not multiply). Currently there is no way to distinguish these cases from the template — we have to guess based on business logic.
Suggested improvement: Add a metadata flag to field definitions (e.g. field_multiply_by_quantity: true/false) so templates can handle both cases correctly without hardcoding assumptions.
3. prices[0]->unit_price in option elements equals prices[0]->price_value_with_tax
When displaying grouped options (group_options = 1), the unit_price nested object inside prices[0] of an option element contains the same value as price_value_with_tax (i.e. total price, not unit price). This makes it impossible to retrieve the true per-unit price for display without manually dividing by cart_product_quantity.
Suggested improvement: Ensure prices[0]->unit_price->price_value_with_tax consistently reflects the price for one unit, regardless of cart quantity.
These improvements would allow template developers to build accurate per-line breakdowns without relying on hardcoded business logic or reverse-engineering prices from totals.
Thank you for considering these improvements.