Vote up!
Vote down!

Display "add to cart" in separate block


I'm developing my first ever commerce site (from scratch):

Can anyone tell me how I can get the add to cart to appear in a block somewhere on this page other than below the image of the product?

http://digforvictory.info/gv2/products/green-bag (scroll down on image and there's an "add to cart" option, i want that "add to cart" to appear in the footer)

Thanks a million

Asked by: tms1970
on November 15, 2013

4 Answers

Vote up!
Vote down!


Great question! This is an easy one, so I went ahead and made a video to walk you through it.


1) Create a view at admin/structure/views/add

- Show content
- Make a block, not a page

2) Add a contextual filter on 'nid'

3) Add a field called 'product' or whatever your product reference field is called.

- make sure you "format" it as an "Add to cart form"
- maybe remove the title field that Views puts in there by default.

4) Save the View

5) Go to your block admin page: admin/structure/block and enable your new block

6) Optionally, remove the add to cart button from your node display.

7) Profit!

Josh Miller
Answer by: Josh Miller
Posted: Nov 15, 2013


Thanks ever so much for the effort you obviously went to to make a video explaining this to me.

It worked perfectly....

I didn't understand it all but I followed it with ease.


- tms1970 on November 19, 2013
Vote up!
Vote down!

How to create an "add to cart" in Drupal 8 commerce?

Answer by: Kirill
Posted: Jun 29, 2016
Vote up!
Vote down!

Using this same method, is there a way to also include values like as price and stock, in such a way that they update dynamically based on an attribute selection?

I am finding that the blocks are completeley static and do not respond to any selections.

Answer by: Paul Driver
Posted: Jul 30, 2014
Vote up!
Vote down!

I also spend some hours trying to create a block containing Product Price, Product SKU and Product Availability fields from the referenced Product.
What I found is that the view in this case should display Commerce products instead of display nodes. Then you can display fields from the product but what about the "Add to cart" form? I created a relation to the referencing node and used it to display the "Add to cart" field from the display node. Contextual filter is on the NID of referencing node. Everything is displayed correctly, but doesn't work correctly. The reason is that you can't choose and switch between the referenced products in views and the block always displays the fields from only one of the referenced products.

For me Views won't do the job.
I tried also Display Suite Block region with no luck - it doesn't display fields from referenced product, only fields from referencing display node.
There are also a couple of modules allowing fields from node display to be rendered as block. Node Fields Block doesn't recognize the fields of the product inside the display node. Only the Field as Block Module is capable of rendering the product fields from display node as blocks, but it has many limitations as each field is a separate block and fields couldn't be grouped in a single block.

If someone knows a way to create a block that contains both product fields and add to cart form, please share your knowledge.

Answer by: Kamen
Posted: Feb 1, 2015