Custom WooCommerce cart page and checkout can be very useful if we selling a single or variable product of same type. We can create button which can redirect customers to directly on checkout or cart page. We gonna follow some predefine WooCommerce URL’s to achieve Custom WooCommerce cart page link based on product and quantity.
Table of Contents
Below are the links which you can add on Buttons or anchor tag to achieve custom cart or checkout page in single click.
Product Based Custom WooCommerce cart page (Cart & Checkout)
https://yourdomain.com/cart/?add-to-cart=X
https://yourdomain.com/checkout/?add-to-cart=X
#Here X is the Product ID which you can get from URL when you open product on WordPress dashboard. Replace yourdomain.com to your website link.
Quantity Based Custom WooCommerce cart page (Cart & Checkout)
https://yourdomain.com/cart/?add-to-cart=X&quantity=Y
https://yourdomain.com/checkout/?add-to-cart=X&quantity=Y
#Here X is the Product ID which you can get from URL when you open product on WordPress dashboard.
#Here Y is the quantity of the product. It can be 1, 2, 3 or any number.
Replace yourdomain.com to your website link.
We can also use same URL structure to redirect custom to any page to improve our upselling. Check the code below
https://yourdomain.com/any-page-url/?add-to-cart=X&quantity=Y
So that’s how you can customize cart and checkout page and redirect customer as per requirement. So try it and let us know how it works.
Happy Coding!