This is a more specific question related to my other question (getting unminified js assets for Narrative).
I want the cart drawer to open when an item is added to a user's cart. Right now the button toggles to "view cart" and allows the user to click that to open the drawer, I just don't want them to have to take that step.
I tried adding the class that is on the "view cart" button to the buy button (.ajax-cart__toggle) in the liquid temple but that just results in the drawer opening but the item not actually being added to the cart.
I'm pretty well versed in js but without being able to see the unminified js code I have no idea where to even start.
Hi John Refano,
I just checked your support request on Shopify Expert forum.
As per your requirement its possible with ajax.
you are very close to solution, Please try to add the same class if you get success response from backend for product add.
If you still face any issue then let us know.
I followed the tutorial found here and added the cart toggle class to the 'View Cart' button that appears after you add the product to cart. The only problem is that the cart drawer isnt updated immediately, but only when the page is refreshed. So close...
Whilst the code has whitespace removed, you can use a tool to pretty print it again if you need. That will make reading / editing easier.
This theme isn't built to show the cart contents after adding so there's currently no action that auto updates its. Things you'll need to look at are:
The forum members are unlikely to give you anything close to copy and paste code but was there something specific you're stuck on? Happy to nudge you in the right direction.
Hi, I know it's a little late to write a solution, but in case someone needs this is an option. You can open the cart automatically after add action with jquery trigger, simulating a click. This is the code for the brooklyn theme
|a minute ago|