This post was last updated on 7/9/2018
WooCommerce was created mainly for online shopping websites, but a lot of people use it for other types of products as well.
So some of you might have one or two products/services that you offer, and you just want a simple pricing table that will send the customer straight to the WooCommerce cart once he presses the “Buy” button, without having to go to the products page first.
Also, the fewer actions a buyer performs before purchasing a product or service, the better! You can lose customers if you put them to click 10 times before purchasing something.
Note that, in this article, I’m talking about pricing tables, not the grid of products from the WooCommerce’s shop page:
Some of you may wonder if you can send customers straight to the cart part after they press the “Add to cart” button found on the WooCommerce products.
Yes, you can! All you need to do is to:
Go to WooCommerce -> Settings -> Products -> General -> check Redirect to the cart page after successful addition and Enable AJAX add to cart buttons on archives.
Now let’s get to our main topic.
Redirect clients to cart from the pricing table button
If your theme doesn’t come with a built-in pricing table feature, you’ll have to use a plugin, of course. Here’s a list of some of the best pricing tables, both free and premium.
Now, the first thing you need to do is to find out your product(s) ID. In order to do that, go to your WooCommerce products and just hover your mouse cursor over the product whose ID you want to find out:
If for some reason it doesn’t display, try one of these methods to find the ID.
Now that you know your product(s) ID, you have to insert the URL that will redirect buyers straight to the WooCommerce cart.
The URL will contain your domain (e.g. http://example.com/), followed by
?add-to-cart= and your product’s ID after “=”.
So, let’s say your product ID is 207. The URL that you’ll have to insert into one of the pricing table buttons is http://example.com/?add-to-cart=207
Of course, instead of “example.com”, you’ll have to add your own domain name.
Update: Tony said in the comments that for him it just refreshes the page, it doesn’t add the product in the cart.
In most cases, this happens because “Enable AJAX add to cart buttons on archives” isn’t checked in WooCommerce -> Products -> Add to cart behavior, as you can see in the above image. So make sure you check that too.
That’s it! Now when the client will pres the “Buy” button, or whatever you want to call it, he will be redirected straight to the cart page!