Let AddToCart button directly link to checkout in Boundless theme

Solved
Highlighted
Tourist
14 0 0

Currently, pressing the AddToCart button opens the cart.

However, I'd like the AddToCart button on my product page to directly link to the checkout page (the page where the customer fills in his/her address information).

 

I tried several suggestions from this page https://community.shopify.com/c/Shopify-Discussion/SOLVED-How-can-I-skip-the-cart-and-go-straight-to...

However, none of them work for me.

 

Could someone tell me how to get this to work in the Boundless theme?

 

Thanks in advance.

0 Likes
Highlighted
Shopify Staff
Shopify Staff
679 63 88

Hello, @mimport .

 

Elias here with Shopify Support. Thank you for this inquiry.

 

I understand you would like to have the add to cart button go directly to the checkout. The accelerated checkout or dynamic checkout can save your customer’s information and allow returning customers to checkout more quickly. Depending on the accelerated checkout method, some can use dynamic checkout, which will allow your customers to skip the cart and go straight to the checkout. This method will allow you to consider hiding the cart icon and/or the add to cart button, giving you the same effect as a direct checkout. Nonetheless, this will affect your customers’ ability to add multiple items to their cart and may impact your sales. That said, is there a specific reason you don't want the cart?

 

If you're interested you can enable the dynamic checkout button by going to the Storefront editor (Online Store > Themes > Customize) , then navigating to the product page. Here's a screenshot for enabling dynamic checkout button on the Boundless theme:

 

10-54-91jqt-7hjtl

 

If you prefer to modify the add to cart button to go straight to checkout, this will require significant modification to your theme’s coding. However, this level of customization does fall outside our design policy. For this reason, I recommend checking with a developer or Shopify Experts as they are best equipped to assist with custom coding.

 

I hope this provides a couple suggestions for you to explore. If you have any other questions on this topic, don’t hesitate to let me know in this thread.

Elias | Social Care @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

0 Likes
Highlighted
Shopify Expert
3900 559 936

This is an accepted solution.

Hi @mimport 

For that you have to made changes in Js file.

1. Open Asset-> theme.js.liquid file and find '/cart/add.js' and then add this line(location.href='/checkout';) in to success function next to this line

also comment 'callback(line_item, form);'

So it look like:

  var params = {
    type: 'POST',
    url: '/cart/add.js',
    data: jQuery(form).serialize(),
    dataType: 'json',
    success: function(line_item) {
      if ((typeof callback) === 'function') {
      location.href='/checkout';
        //callback(line_item, form);
      }
      else {
        Shopify.onItemAdded(line_item, form);
      }
    },
    error: function(XMLHttpRequest, textStatus) {
      if ((typeof errorCallback) === 'function') {
        errorCallback(XMLHttpRequest, textStatus);
      }
      else {
        Shopify.onError(XMLHttpRequest, textStatus);
      }
    }
  };
Want to modify or custom changes on store hire me.
Want to give Gift for time? its my Paypal too.
If helpful then please Like and Accept Solution.
Email: jasoliyabrijesh123@gmail.com Or WhatsApp
Skype: jasoliya.brijesh
Want to get Free review and advice for sale on store ?? just text me here
Highlighted
Highlighted
Tourist
14 0 0

Awesome! Worked like a charm.

0 Likes