2

I've created a content type with a product reference field, but when I create a content with the reference to the product, it shows add to cart form with only add to cart button. I wanted to display Price, quantity, and product attributes on the add to cart form. I've searched a lot to find out any configuration for this, but no luck. Can anyone please help me regarding this?. It works fine in Drupal 7, but in Drupal 8 there is no way I can set up the form.

3 Answers 3

2

First be aware that Commerce is still in Alpha, so behavior might change between versions!

I suppose you are looking for something like this from the Drupal Commerce Blog. Commerce form display

I have no idea how to get there as I am awaiting a more stable version of Drupal Commerce, but I suppose the breadcrumb in the image should give you some directions on where to find these settings.

4
  • Thanks for the answer, I got it configured, But is not rendered properly. Price is shown as editable field, etc.
    – WebLink
    Apr 9, 2016 at 8:23
  • Another interesting thing is, I cannot see any checkout button on the cart page...! Please let me know, if you found anything about this.
    – WebLink
    Apr 9, 2016 at 8:24
  • Are you sure you edited the form display and not the fields? Apr 9, 2016 at 9:41
  • Yes, The form display itself. However, for the time being I've rolled back to D7 itself.
    – WebLink
    Apr 9, 2016 at 10:45
1

I wanted to address your question Sky Buzz, regarding exposing the 'quantity' field and an 'editable price field' with the 'add to cart form' on product pages.

I posted the below here: https://www.drupal.org/node/2702989#comment-12134795

For posterity, I wanted to post the solution I found here, as I ran in to similar symptoms with Commerce 2.x with D8, only to learn I wasn't looking the right places.

Regarding exposing the quantity field, that is done at Commerce > Configuration > Order Item Types > Default > Manage Form Display > the Add to Cart display.

There you can move the quantity field out of the "disabled section"

or here on my site: /admin/commerce/config/order-item-types/default/edit/form-display/add_to_cart

as mentioned here: https://drupalcommerce.org/blog/44226/commerce-20-alpha3-released

Regarding price showing up as an editable field, this happens if you move the "Unit Price" field up out of the "disabled" section" on the SAME PAGE mentioned above. So i recommend NOT doing that (not sure in what context that'd be used for, but it's a gotcha for some).

The price output happens on the Product Variation Type manage display or here on my site: /admin/commerce/config/product-variation-types/default/edit/display

There, you can move the Price out of the "disabled section" as it should be by default (or SKU, etc).

1

Another reason for price not showing may be a disabled Inject product variation fields into the rendered product. option for your product type at /admin/commerce/config/product-types/default/edit

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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