From c9aea81d3c3c29366d57205ebda78f3da6fd170c Mon Sep 17 00:00:00 2001 From: Markus Haack Date: Fri, 27 Oct 2023 09:44:38 +0200 Subject: [PATCH 1/2] fix: order options for hero --- blocks/ordering-options/ordering-options.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/blocks/ordering-options/ordering-options.js b/blocks/ordering-options/ordering-options.js index 980760985..45e307ad1 100644 --- a/blocks/ordering-options/ordering-options.js +++ b/blocks/ordering-options/ordering-options.js @@ -418,7 +418,8 @@ async function renderOptions(orderBlock, heroBlock, productRefs, itemDescription function showHideStoreFeature(showStore, orderBlock, heroBlock) { renderCartWidget(showStore); - const heroOrder = heroBlock.querySelector('.order-container'); + let heroOrder = heroBlock?.querySelector('.order-container'); + if (heroOrder && heroBlock.querySelector('img')) heroOrder = undefined; if (showStore) { orderBlock.classList.remove(STORE_HIDDEN_CLASS); if (heroOrder) heroOrder.classList.remove(STORE_HIDDEN_CLASS); @@ -462,6 +463,6 @@ export default async function decorate(block) { showHideStoreFeature(showStore, block, heroBlock); document.addEventListener('geolocationUpdated', () => { - showHideStoreFeature(block, showStore); + showHideStoreFeature(showStore, block, heroBlock); }); } From 7f3f7bd2e72900a6361d9c02370d1969bd54d76e Mon Sep 17 00:00:00 2001 From: Markus Haack Date: Fri, 27 Oct 2023 16:44:51 +0200 Subject: [PATCH 2/2] fix: button display --- blocks/ordering-options/ordering-options.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/blocks/ordering-options/ordering-options.js b/blocks/ordering-options/ordering-options.js index 45e307ad1..2636836eb 100644 --- a/blocks/ordering-options/ordering-options.js +++ b/blocks/ordering-options/ordering-options.js @@ -422,12 +422,14 @@ function showHideStoreFeature(showStore, orderBlock, heroBlock) { if (heroOrder && heroBlock.querySelector('img')) heroOrder = undefined; if (showStore) { orderBlock.classList.remove(STORE_HIDDEN_CLASS); - if (heroOrder) heroOrder.classList.remove(STORE_HIDDEN_CLASS); - // hide buttons in hero and instead show option form - if (heroBlock) { - heroBlock.querySelectorAll('.button-container').forEach((buttonContainer) => { - buttonContainer.remove(); - }); + if (heroOrder) { + heroOrder.classList.remove(STORE_HIDDEN_CLASS); + // hide buttons in hero and instead show option form + if (heroBlock) { + heroBlock.querySelectorAll('.button-container').forEach((buttonContainer) => { + buttonContainer.remove(); + }); + } } } else { orderBlock.classList.add(STORE_HIDDEN_CLASS);