When I create several variations for a product, a selector appears on the page and allows you to modify the variation :

Screenshot "Relax service détente S1BIOSE.png"

When I create a single variation for a product, there is no selector.

How to force the display of the selector ? I want all my product is the same appearance.

Screenshot "Massage ayurvédique S1BIOSE.png"

Comments

zenimagine created an issue. See original summary.

zenimagine’s picture

Status: Active » Closed (works as designed)
StatusFileSize
new51.84 KB
zenimagine’s picture

Category: Support request » Bug report
Status: Closed (works as designed) » Active

When "Product variation title" is selected in /admin/commerce/config/order-item-types/produit/edit/form-display/add_to_cart and if there is only one variation, it will not is not displayed on the product page.

When "Product variation attributs" is selected in /admin/commerce/config/order-item-types/produit/edit/form-display/add_to_cart and if there is only one variation, it is displayed on the product page.

How to display the variation even if it has only one with "Product variation title"?

zenimagine’s picture

Title: How to keep the variation selector ? » "Product variation title" is not displayed if there is only one variation
zenimagine’s picture

Category: Bug report » Feature request
zenimagine’s picture

Does anyone have a solution for this problem ?

captaindav’s picture

Title: "Product variation title" is not displayed if there is only one variation » "Product variation title" is not displayed if there is only a single (one) variation
captaindav’s picture

Per 8/28 Skype discussion with bojanz, he stated the existing code in ProductVariationTitleWidget.php checks to see if there is only one variation, and if there is, the variation title is omitted. The code is located in lines 84-92 of ProductVariationtitleWidget.php. I verified that commenting out those lines of code, then clearing the cache, has the desired result. bojanz agreed that it would be desirable to have this configurable, so I will create a patch that makes a configuration setting for this at some point in the future. Until then I have created a temporary patch that I am applying with composer that simply deletes lines 84-92.

captaindav’s picture

Assigned: Unassigned » captaindav
czigor’s picture

Status: Active » Needs work
StatusFileSize
new2 KB

Tests are still needed.

czigor’s picture

Status: Needs work » Needs review

Let's see what the testbot says.

Status: Needs review » Needs work

The last submitted patch, 10: commerce-2980488-hide_for_one_variation-10.patch, failed testing. View results

czigor’s picture

Status: Needs work » Needs review
StatusFileSize
new2.58 KB
new461 bytes

Adding schema.

czigor’s picture

Assigned: captaindav » Unassigned
zenimagine’s picture

@czigor Hi thanks for the patch, where should we set ?

czigor’s picture

In the order item type's "Add to cart" form display mode.

zenimagine’s picture

StatusFileSize
new116.38 KB

@czigor sorry I do not see the parameter

zenimagine’s picture

@czigor Ok sorry I made a mistake. The patch works and the variation appears :-)

czigor’s picture

Great, thanks for testing!

bojanz’s picture

Tweaked the setting name since we already use hide_single in multiple places.

We are missing test coverage, but it looks like the entire widget has very low test coverage, so we'll have to fix it in a followup.

bojanz’s picture

Status: Needs review » Fixed

Committed.

  • bojanz committed 45b7d3f on 8.x-2.x authored by czigor
    Issue #2980488 by czigor, bojanz: "Product variation title" is not...

Status: Fixed » Closed (fixed)

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