How to create direct checkout link in Woocommerce

Asked by: jenniryan
Date:
Viewed: 325
Answers: 1
  • 0

Hi,

How can I create a direct checkout link from a WooCommerce product? So that when I click on a button, for example, then I’m redirected to the cart or checkout page with the product added?

Thanks

Answers

Answer by: ChristianKovats

Answered on: 21 Jul 2023

  • 0

First, you need to get the ID of your product. If you edit your product, you should see something like this in your address bar:

https://yoursite.com/wp-admin/post.php?post=49&action=edit

49 is the ID of the product. Yours will obviously be different.

If you want to put the product to the cart and want to redirect the user to the cart page, use this url

https://yoursite.com/cart/?add-to-cart=49

If you want to add the product to the cart, and redirect the customer straight to the checkout page, use this url

https://yoursite.com/checkout/?add-to-cart=49

 

Please log in to post an answer!