Expanding the functionality of ajaxify cart in Supply theme

Shopify Partner
4 2 0



I've been making a new theme based on supply. We'd like to display accessories on a product page with an inline add to cart button. However a basic add to cart form will link straight to the cart page.


Having looked at the code it seems to only override the submit button of one form by id.Rewriting all the js to iterate through each form on the page is a little beyond me.


Preventing a redirect and unhiding the modal on click is easy enough, but this is far from a robust solution


Does anyone have an existing implementation?



Shopify Expert
3479 543 820

Hi @Matt_Stockdale 

If you want to add to cart accessories product product page without going to cart page then you have to implement ajax cart function for that,

You can add Add to cart js function that add product to cart, may be you can follow this 

Want to modify or custom changes on store hire me.
If helpful then please Like and Accept Solution.
Email: jasoliyabrijesh123@gmail.com
Skype: jasoliya.brijesh
Want to get Free review and advice for sale on store ?? just text me here
Shopify Partner
4 2 0

This is an accepted solution.

Useless reply.


I ended up just copypasting the cart instantiation code and changing some of the selectors to the classes on the new forms, which seems to work just fine


      if ($('.addToCartForm').length) {          
        method: '{{ settings.ajax_cart_method }}',
        wrapperClass: 'wrapper',
        formSelector: '.addToCartForm',
        addToCartSelector: '.addToCart-' + sectionId,
        cartCountSelector: '.cart-count',
        toggleCartButton: '.cart-toggle',
        useCartTemplate: true,
        btnClass: 'btn',
        moneyFormat: moneyFormat,
        disableAjaxCart: false,
        enableQtySelectors: false