Incomplete product variation

Steps to reproduce:

Install commerce 2.x-dev
Install checkout, cart and product
Create a new store
Create a new product and product variation

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bamjam created an issue. See original summary.

SpartyDan’s picture

Status: Active » Needs work
FileSize
49.96 KB

It appears to me that the issue is with the add product form. A "Create variation" button is displayed on the form even though no Product Attributes yet exist.

Add Product Form

I think that the "Create variation" button should not be displayed on the Add Product form unless at least one Product Attribute exists.

Products can exist without a Product Variation but Product Variations seem to directly require the existence of at least one Product Attribute.

SpartyDan’s picture

Status: Needs work » Active

Sorry, wrong status.

mglaman’s picture

I think that the "Create variation" button should not be displayed on the Add Product form unless at least one Product Attribute exists.

We allow this. The real problem, that I can see, is that the price field is not required. You do not have to use product attributes. That needs to be tidied up in #2690681: Simplify the variation UX when each product has a single variation

The price field is not required because

    // The price is not required because it's not guaranteed to be used
    // for storage (there might be a price per currency, role, country, etc).

I think we need to change this. We need to ensure there is some form of price always available.

mglaman’s picture

Assigned: Unassigned » bojanz

Assigning to bojanz to give feedback on #4

rattusrattus’s picture

mglaman in my experience the issue wasn't due to a field not being required as a price was supplied it just appeared not be saved.

nimbfire’s picture

The Price (and all variants fields, for what I can see) is only saved after we submit the form. If you create two variants and save, they will work correctly.
The "price not appearing" I think its a problem of the default value. If you let the price as default, it will not appear even on products without variants, or whith correctly configured variants.
After creating an product only providing an title and an SKU, submitting and returning to the edit page, the "title" and "price" in the variants table are empty. Considering that we haven't added an product attribute yet.

Since the "Title" in the table seems to use the Product Attributes , I think the correct would be the "add variant" button to not appear, since there would be no way of discerning two variants.
But, this would mean that we need to present the price and sku again in the edit page. Now, this is made by the variants table... I don't know if we shouldn't just update the variants table to not allow to add more, and hide the title... What do you think?

Anyway, I do believe we should not allow an user to add an variant if there aren't Product Attributes yet.

mglaman’s picture

Status: Active » Closed (duplicate)

Okay, more and more this sounds like it is #2690681: Simplify the variation UX when each product has a single variation. Where if there are no attributes prevent adding multiple variants. Instead act as if cardinality is one.

Anyone involved, feel free to revert status if I am incorrect.