admin管理员组文章数量:1130349
I want to promote a certain product on a non-shop page. I want to have a Buy now link on that page, which, when clicked, would add the product to the cart and automatically reload the page and redirect the customer to the cart. This should be done only for that certain product and should not be enabled for all products (so the Redirect to the cart page after successful addition option should NOT be set to TRUE).
I want to promote a certain product on a non-shop page. I want to have a Buy now link on that page, which, when clicked, would add the product to the cart and automatically reload the page and redirect the customer to the cart. This should be done only for that certain product and should not be enabled for all products (so the Redirect to the cart page after successful addition option should NOT be set to TRUE).
1 Answer
Reset to default 0You can create "add to cart" links for WooCommerce using this pattern on simple links:
http://example/cart/?add-to-cart=<product ID>&quantity=<number of quantity>
This example will work with simple products.
If you want to use products with variations you need to add some more values to the URL like:
http://example/cart/?add-to-cart=123&variation_id=456&attribute_pa_colour=black
If you enter the slug of the cart page in this url, here: /cart/, it should redirect to the cart.
To add a product to the cart without redirecting:
http://example/?add-to-cart=<product ID>
I want to promote a certain product on a non-shop page. I want to have a Buy now link on that page, which, when clicked, would add the product to the cart and automatically reload the page and redirect the customer to the cart. This should be done only for that certain product and should not be enabled for all products (so the Redirect to the cart page after successful addition option should NOT be set to TRUE).
I want to promote a certain product on a non-shop page. I want to have a Buy now link on that page, which, when clicked, would add the product to the cart and automatically reload the page and redirect the customer to the cart. This should be done only for that certain product and should not be enabled for all products (so the Redirect to the cart page after successful addition option should NOT be set to TRUE).
1 Answer
Reset to default 0You can create "add to cart" links for WooCommerce using this pattern on simple links:
http://example/cart/?add-to-cart=<product ID>&quantity=<number of quantity>
This example will work with simple products.
If you want to use products with variations you need to add some more values to the URL like:
http://example/cart/?add-to-cart=123&variation_id=456&attribute_pa_colour=black
If you enter the slug of the cart page in this url, here: /cart/, it should redirect to the cart.
To add a product to the cart without redirecting:
http://example/?add-to-cart=<product ID>
本文标签: WooCommerce How can I add a certain product to the cart and redirect to the cart from a nonshop page
版权声明:本文标题:WooCommerce: How can I add a certain product to the cart and redirect to the cart from a non-shop page? 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749248719a2339330.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论