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.

Comments

SkyBuzz created an issue. See original summary.

SkyBuzz’s picture

There are lots of issues in this, I've got it set up from this answer on stackexchange. But when I configured, price is shown as editable field.

And another problem is, I cannot see any checkout button on the cart page...!

bojanz’s picture

Status: Active » Fixed

This issue was created before Commerce 2.x had checkout, hence no checkout button.

The add to cart form is fully functional, so I suggest retesting with the latest -dev.
The Quantity field is enabled on the "manage display" form for line items ("add to cart" view mode).

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

SchwebDesign’s picture

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).

Hope that helps!

int_ua’s picture

For anyone trying to figure out how to output the price for the product: maybe you simple disabled the Inject product variation fields into the rendered product. at /admin/commerce/config/product-types/default/edit.