Optional linked products offered per product. On a product page the customer can tick one or more add-ons (checkbox + quantity); each is added to the cart as its own line item, inheriting the parent's hub and booking dates — no re-entry of dates required.
product-addons/product-addons.phpaddon_products).recette_composants) — not a PluginHive-bookable product. Its per-hub stock comes from the recipe, like any product.
Mirrors the existing hub_id propagation chain.
addon_productswoocommerce_add_to_cart, read $_POST['mobil_addons'] and add each ticked add-on as its own line with hub_id + parent link in cart_item_datareserve_components_on_add_to_cart reserves the add-on's composants (existing system)woocommerce_get_item_data (“Add-on for: …”)hub_id copied to the order item (existing); parent booking dates copied onto the add-ondecrementer_stock_avec_composants_auto deducts stock per item (existing)The feature was designed to not touch any stock code. Add-ons are ordinary separate line items, so every existing hook treats them like any product.
| Check | Result |
|---|---|
| Stock / reservation / deduction files modified | none |
| Add-on reservation | generic reserve_components_on_add_to_cart (separate line + hub_id) |
| Checkout deduction | generic per-item loop decrementer_stock_avec_composants_auto |
Legacy selected_addons meta | dead stub, never written → no double-deduction |
| Quantity (parent qty overriding add-on qty) | fixed via mobil_requested_qty filter (priority 99) |
| Backup before changes | backup-fulltheme-20260617-185451 |
php -l | no syntax errors |
recette_composants. An add-on without a recipe is sold with no stock control (reservation/deduction skip it).