Narrative Theme: skip "View Cart" transition state and jump directly to open cart drawer

New Member
2 0 1

Hi All,

In the Narrative Theme, the "Add To Cart" button on the product page when clicked transitions into a "View Cart" button (with secondary styling). Then, the "View Cart" button has to be clicked to actually get the cart drawer to open. I want the "Add To Cart" button to straight up add the product to the cart AND open the cart drawer right after without having to go through and click the "View Cart" cart transition state.

I was able to achieve part of this functionality by adding a ajax-cart__toggle class to the "Add To Cart" button in product-form.liquid, but that caused an issue: the cart drawer would open on first click of "Add To Cart" but no product was actually added. I think the culprit for that is how the theme.min.js.liquid file is set up. The way the js file is set up, the whole thing would go back to as it was after the first click due to the .addclass and .removeclass codes in js file.

I figured I should ask the community for any help or insight into this before I try to understand and change the minified javascript file as a novice coder. I have a little bit of what the js does but cannot pinpoint how exactly to acheve the functionality I want after two days of soul searching lol. Looking forward to it!

1 Like