But how about adding add to cart button in your cms page? That's simple! All you need to know is the id of your product and this snippet below.
<button onclick="location.href ='{{config path="web/unsecure/base_url"}}/checkout/cart/add?product=1&qty=1'">Add To Cart</button>
Just change the value of the query string "product" to the id of your product. You can see the product id by going to Catalog-> Manage products. Ids’ are number before the product name in the list.
That's it. Save your page and refresh your cache and try to click the "Add To Cart" button to test it.
6 comments:
what if specific product attributes are wanted?
I am wondering the same thing. Is there a way to make a parent product with the option to select a child, or something to that effect? I tried this and it worked, only if I use one of the children products as the product id. It works if I use a parent, but it then takes me to the product page to select attributes which defeats the purpose of adding the button. My old landing pages took me to the product page and I was trying to cut out a step by adding to cart directly from the landing pages.
for configurable products an example is http://www.your_domain.com/checkout/cart/add?product=68&qty=1&super_attribute[528]=55&super_attribute[525]=56
brgds!
for configurable product with attributes the url must be in the following way http://www.your_domain.com/checkout/cart/add?product=68&qty=1&super_attribute[528]=55&super_attribute[525]=56
I've followed these steps and when I click Add to Cart it takes me to a blank cart. Nothing was added.
I did what was said and I still get nothing in my checkout part.
Post a Comment