Add a "Refresh Cart" Button

Solved
Highlighted
Tourist
3 1 0

Hello,

I'm trying to add a button to my cart that refreshes it or the page. My liquid-fu is weak, but I have a couple apps that I think will perform better with this function.

Funnily enough, searching mostly results in people trying to remove this button from their theme!

Thank you!

0 Likes
Highlighted
Shopify Partner
995 43 119

Dear WanderingWizard,

 

Why do not you go for auto refresh as per variant? May be it is a great feature.

Thanks & Regards
MS Web Designer
Get Free Store Audit Report
20000+ Task Completed
1000+ Satisfied Client
9.9*/10 Customer Rating
10*/10 Shopify Services Marketplace
0 Likes
Highlighted
Shopify Expert
9852 98 1616

How would a refresh button differ from a button/link that just reloads the current cart page? If your web development skills are not very strong that would be the quickest and easiest approach.

 

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au
0 Likes
Tourist
3 1 0

I assume a button that simply linked back to the cart would work great, though I hadn't considered that. I'll look into copying the one from the Product page. I know a refresh would work because the cart does update when I hit the refresh button on my browser.

As for auto-refresh, it doesn't seem to reload the rest of my apps when the cart auto-refreshes, and I am okay with the button solution.

0 Likes
Highlighted

Success.

Tourist
3 1 0

Thank you for the suggestions! Simply linking to the page in a button seems to have done the trick. I added a couple lines in the "btn-group" in cart-template.liquid section.

            <button type="submit" name="Refresh Cart" class="btn btn--loader" href={{ cart }} data-cart-submit>
              {{ 'cart.general.update' | t }}
              <span class="btn--loader-balls"></span>
            </button>

It's probably ugly code, but it does the job!

0 Likes