When you add products to the cart so this is the best option to switch a user into a customer. That’s why add a custom “Add To Cart” URL in your WooCommerce store, so that the customers can add their products easily to the cart from your details page or from your WooCommerce setup store, for example, ordinary products.
But sometimes it is not enough. It would be better to have a landing page featuring a terrific product created by you. In this situation you can use the shortcode
If you are using Visual Builder or Pricing Table Plugin so you can also create your own button using the Add Add to Cart URL. This is more useful for your WooCommerce store.
In those cases, Add to Cart shortcode cannot work properly, styling may be a problem because it may not be compatible with the plugin you are using.
In those cases, you have to create your Add to Cart URL. Doing this is as easy as drinking a glass of water.
Open your dashboard and go to the products.
In the list of products, go to the product that you want to add a custom Add to Cart. On the left side, you will see a message such as ID: 123 where 123 is the product ID.
To create a Custom Add to Cart URL for that product, you must add 123 to add-to-cart = 123 with your product ID.
The result will be something like this:
https://www.yourwebsite.com/?add-to-cart=123 Anyone who clicks on this link will add product 123 to their cart.
What’s great about this?
That you can use it anywhere. You can create a pricing table with different levels for your product and people can leave the product page and connect it directly to your landing page with pricing table, which is already fine for the Google ad campaign. And is well-indexed on Google’s other search engines.
How to create a URL for a variable product too?
However, you need more steps, because you need to create the URL in which you want to add to the cart.
The easiest way to create an Add to Cart URL for a variable product is to go to the Variables product page and choose the options that you want to use in your URL. Then add a product to the cart and go to the cart page.
For example, I have a T-shirt for which the customer can choose size and color. I want to offer a black small T-shirt. So I will go to the product page and choose smaller for size and black color and then I will click on Add to Cart.
By going to the cart, we will have:
Click on the product name with the right mouse button and click on the copy link address.
You will have something like this:
After copying the part? In URL: attribute_size = smallandattribute_ color = black
Then start building your URL exactly as you did before, add your product ID and add-to-cart = 123 to the URL. After this last part, you will need the Variation ID to specify what you want to add to the cart.
To get the variation ID, open the product admin page, and click on tab variations. In the Variation list, you will see their ID on the left, in this example, you will see such a diversity in your admin:
You are not ready yet. After the Variation ID, you need to add a part of the URL that I asked to copy before the cart page.
The entire URL will look like this:
Now you can use this URL on your landing page, on your pricing table, or in a button, wherever you want.
By clicking on it, your customers will add a small black t-shirt to your car.