0

I want to add an Add to Cart button to my products when they are still in the Collection Products view (Category overview). By default, when you navigate to a category like /commerce_kickstart/product-category/sample-category-1, you will find the single products display like this:

enter image description here

I would like to have all of the single products be shown like this:

enter image description here

In the Product Display content type, the add-to-cart-form is stored in $content variable. It is pretty easy to access via field_productand I can for example add multiple forms and stuff. But how can I get the form in the Collections Product view? I went to Structure -> Views -> Collection Products -> Field and looked through the available fields. I found field_product but when I add this, everthing that changes is that a link to the product is shown underneath the price.

So how can I add this to the Category overview?

Edit:

I have added this field (because the name appeared to be familiar scince the cart form is stored in this variable (field_product) in node--product_display

https: //i.stack.imgur.com/CaNo9.png

And that caused this to appear, wich only adds a link to the product underneath the price.

https: //i.stack.imgur.com/1vbWW.png

And this is basically all the configuration besides some more irrelevant stuff:

https: //i.stack.imgur.com/fk9BB.png

  • In your view's field_product, do you not see the option "add to cart" under "Formatter"? Can you add a screenshot of your view configuration page? – longboardnode Oct 16 '17 at 16:10
  • @longboardnode I have added the screens (Sorry for plain text links, cant post more than 2 due to lack of reputation in this community) – JT 1114 Oct 16 '17 at 16:34
  • In your view, can you add a relationship to the product category in your cart? It should be visible as Referenced Entity or Referenced Product... basically in views you need to join your node/product to its related store/product, once you have done that you should see an available field "% to buy" with the formatter "add to cart button" – longboardnode Oct 17 '17 at 1:25
  • i.stack.imgur.com/JAE5W.jpg You are a lifesaver, I would have never been able to find it myself – JT 1114 Oct 17 '17 at 6:52
  • Good to hear it worked! I added as answer, plz accept if was helpful. – longboardnode Oct 17 '17 at 14:39
0

In your view, can you add a relationship to the product category in your cart? It should be visible as Referenced Entity or Referenced Product... basically in views you need to join your node/product to its related store/product, once you have done that you should see an available field "% to buy" with the formatter "add to cart button"

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.