Hi!
When the cart is empty, I would like the cart drawer to close when you click “Back to the store” As it is now, you are sent to a URL instead.
So I would like to have the same behavior as if you click on the “X” in the upper right corner of the empty cart.
Is that doable?
Preview: https://t03hd3gmb5umo1a6-41288433815.shopifypreview.com
Thanks!
Hello @entranced ,
Yes it’s doable with a little edit in the code. I have tested on Dawn theme however following these steps should work for Be Yours theme:
- Online store > Themes > Edit Code > From search files find: “cart-drawer.liquid”
- Inside the cart-drawer file find the code for:
- You can use CTRL+F shortcut and type “drawer-close-button” inside the code file to find easy.
- Copy the exact code in your file, (there may be little changes to what I provide above)
- Next, in the same file find the code for:
Återvänd till butiken
- Button name is probably rendered with a liquid code inside brackets {{ }} instead of plain “Återvänd till butiken”. You can find it by CTRL+F: “button button–tertiary”. Whatever is inside the … copy it and delete … that is identical to the one I provided above.
- Where you deleted the code, replace it with:
drawer-close-button gives the close functionality. By applying class=“button button–tertiary” we give it the proper style, and copy the text from … (Återvänd till butiken). So that It works just as a close button instead of a link but with the same appearance.
This should fix your issue, however there is a slight chance that the exact steps might not work since I don’t have access to Be Yours theme source code. Make sure to duplicate your theme before making any changes.
I hope it helps and good luck! Feel free to reach out if you need any further assistance.
Best regards,
Eray Barslan | Shopify Developer & Designer
1 Like