cart drawer and general structure

This commit is contained in:
elvira
2026-09-04 19:39:37 +03:00
parent c5f7b28aa0
commit 7577426f49
22 changed files with 1075 additions and 8 deletions
@@ -38,6 +38,13 @@ export default class extends Controller {
this.imageTarget.src = variant.image
}
// Keep the checkout module's add-to-cart form pointed at the chosen
// variant. [data-bbk-purchasable-input] is that module's documented
// hook (see resources/views/checkout/components/add-to-cart.blade.php);
// this is the one place the two touch.
const purchasableInput = this.element.querySelector('[data-bbk-purchasable-input]')
if (purchasableInput) purchasableInput.value = id
this.swatchTargets.forEach(swatch => {
const isSelected = parseInt(swatch.dataset.variantId) === id
swatch.classList.toggle('is-selected', isSelected)