Can I stop a second click from closing or collapsing the selected offer?
Clicking the selected offer again collapses it. No setting changes this, but a developer can keep it open with our JavaScript hook.
No setting changes this. Tapping or clicking the picked offer a second time unselects it and collapses it. A developer can keep it selected with a short script in your theme. The offer then stays open until the shopper picks another one.
What happens today
- The shopper taps the picked offer again.
- The offer unselects and its variant pickers close.
- No offer is picked. Add to cart works like your theme's normal button. The widget adds no offer, gift or add-on.
There's no switch for this in the bundle editor or the theme editor.
Keep the offer selected with code
This is custom code in your theme. Ask a developer to add it, and test it on a copy of your theme first.
Don't want to edit theme code? Open the chat bubble in the Section Store app or email [email protected], and we'll look at it with you.
- In Shopify admin, open Online Store → Themes.
- Click ... next to your theme, then Edit code.
- Open
layout/theme.liquid. - Paste this right before
</body>:
<script>
(function () {
function keepOfferSelected() { return false; }
function addHook() { window.SectionStoreBundle.onBeforeDeselectOffer(keepOfferSelected); }
if (window.SectionStoreBundle) addHook();
else document.addEventListener("section-store:bundle:ready", addHook, { once: true });
})();
</script>
- Click Save.
- Open a product page and tap the picked offer. It stays selected.
Returning false keeps the offer selected for every bundle on the page. To do this for one bundle only, replace the keepOfferSelected line with this one:
function keepOfferSelected(details) { return details.bundleShortId !== "your-bundle-id"; }
Run SectionStoreBundle.all() in your browser console on that product page to find the bundleShortId. Run SectionStoreBundle.help() for the full list of methods.
Good to know
- Tapping another offer still switches to it.
- Without a Default offer, nothing is picked when the page loads. Tick one so an offer starts open.
- The code stays in your theme, so a new theme needs it again.
Related
Also searched as: second click closes offer, offer closes when clicked again, unselect offer, deselect offer, stop deselecting, offer toggles off, keep offer open, keep offer selected, double tap offer, offer collapses on click, bundle javascript hook, onbeforedeselectoffer, sectionstorebundle, selected offer collapses when clicked again, keep offer open until another is picked, offer stays open until another is selected, clicking selected offer again closes it, stop offer collapsing, повторное нажатие на выбранное предложение, предложение сворачивается при повторном нажатии, не сворачивалось предложение, оставить предложение открытым, выбранное предложение сворачивается, снять выбор с предложения
Did this answer your question?