0
votes

I have a product landing page that is hosted on a static site (due to various reasons we can't have it created in WordPress). I want to redirect users to the WooCommerce checkout page when they click Buy on this page.

The page consists of a few checkboxes and radio buttons, which are essentially options for a few different products. So, when customer clicks Buy, the WooCommerce cart should contain those products with selected options.

I've created those products in WooCommerce. I've looked at the 'add to cart' URL feature. This option would require a different URL for every possible combination of selected options on the landing page.

Is there a way to have just one URL in the form action attribute on the landing page, and have it send all the information to WooCommerce? And how could that information be used in WooCommerce to add those products to the cart?

1

1 Answers

0
votes

You can find the product ID for the product and link the button on your landing page directly to your Woocommerce store itself.

Example:

You have a store called 'Productstore' on https://productstore.com. By adding a button on your product landingpage with the href="https://productstore.com/cart/?add-to-cart=ID" you can redirect to the product being added to the cart of your store. You just need to add the ID (product id) to the URL. If you want to redirect them to checkout (or any other page) you can change the '/cart/' to checkout, https://productstore.com/checkout/?add-to-cart=1.

To add multiple products to the cart, you can use quantity in the URL like so: https://productstore.com/?add-to-cart=14601&quantity=5.

Im not sure if it is possible to add multiple products with one link, but following this post you might be able to achieve it: https://dsgnwrks.pro/snippets/woocommerce-allow-adding-multiple-products-to-the-cart-via-the-add-to-cart-query-string/

For more information, I used this source: https://www.businessbloomer.com/woocommerce-custom-add-cart-urls-ultimate-guide/.

/** EDIT **
Adding multiple items to WooCommerce cart at once - seems to have worked for OP.