Developer notes
How a box is stored
Section titled “How a box is stored”A box in the cart is a group of ordinary cart lines that share extra.kv_bab.uid:
- slot 0: the box page product (packaging fee, gift message,
totalandsumof the box); - slots 1..n: the chosen products, one line per slot,
extra.kv_bab = {uid, box, size, n, slot, qty, reg}.
The builder posts the group to the core checkout.add (product_data[kvbab0..n]). The pre_add_to_cart hook checks the whole box again on the server (box active, size, item count, eligible products, repeat rules, stock) and stamps the lines; anything else is dropped. Prices are set in get_cart_product_data.
Hooks used
Section titled “Hooks used”pre_add_to_cart, generate_cart_id, add_product_to_cart_check_price, get_cart_product_data, pre_promotion_validate, delete_cart_product, update_cart_products_post, place_order, delete_product_post (all available in 4.17.2 to 4.21.x).
Template hooks: products:product_detail_bottom (builder), products:add_to_cart, products:qty, products:product_amount, products:prices_block (box pages only), checkout:product_info, checkout:minicart_product_info, orders:product_info (storefront and admin).
Tables
Section titled “Tables”?:kv_bab_boxes: one row per box (box page product, item source, rules).?:kv_bab_sizes: sizes and prices of a box.?:kv_bab_sales: one row per sold box (order, size, quantity, total, regular total, items) for the report.
Template helpers
Section titled “Template helpers”fn_kv_build_a_box_page($product_id), fn_kv_build_a_box_is_box($product_id), fn_kv_build_a_box_from_price($product_id) and fn_kv_build_a_box_boxes($products) can be used as Smarty modifiers in custom themes.
Full page cache
Section titled “Full page cache”The builder markup contains no session data. The selection, prices and the post data are built in the browser; the server recalculates everything.