Cart & Checkout Attributes: Storefront
The plugin's Twig Hooks in cart, checkout sidebar and order summary, reuse of the attribute partials and column suppression.
Cart & Checkout Attributes: Storefront
Twig Hooks
The plugin never overrides core templates - it attaches to existing hook points via Twig Hooks:
| Hook point | Location | Priority |
|---|---|---|
sylius_shop.cart.index.content.form.sections.general.items.head |
Cart table header | 250 |
sylius_shop.cart.index.content.form.sections.general.items.body |
Cart table cell | 250 |
sylius_shop.checkout.common.sidebar.summary.items.item |
Checkout sidebar, per item (address, shipping, payment steps) | 150 |
sylius_shop.shared.order.show.summary.table.header |
Order summary table header | 250 |
sylius_shop.shared.order.show.summary.table.body |
Order summary table cell | 250 |
Sylius has no separate header hook point for the checkout sidebar, only the per-item one.
The last two hooks are reused: the same table renders both the order confirmation after checkout and the account order history, each through that page's own _prefixes merge.
Reusing the attribute partials
Values are not formatted by the plugin itself but rendered through Sylius' own @SyliusAttribute/Types/*.html.twig partials (with @SyliusAttribute/Types/default.html.twig as a fallback) - the same partials the product page uses. Checkbox, date, percent and select values therefore look exactly as they do there, with no formatting logic of the plugin's own.
Column suppression
Each of the five templates independently checks, before rendering, whether that column should be visible at all - keeping the header and the cell always in lockstep. If a column is not visible (kill switch off, or no attribute configured with that flag), the <th>/<td> is not rendered at all, rather than being left empty.
Theme compatibility
If a theme fully replaces one of the hook points above (instead of extending it with a further hook), nothing from this plugin renders there - no error, the feature simply does not appear at that spot.
The visibility checks are computed once per request and cached for the rest of it. This is unproblematic under PHP-FPM; under long-running runtimes there is a limitation, see Troubleshooting.