Problem/Motivation

When you create a new product type the variation field is set to hidden by default. This needs to be set to the add to cart form for the default display.

Proposed resolution

Fix the display config when making product types.

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
Manage_display___Site-Install.png56.02 KBmglaman
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mglaman created an issue. See original summary.

bojanz’s picture

We're missing a piece in commerce_product_add_variations_field().

We do this for the form mode:

    // Assign widget settings for the 'default' form mode.
    entity_get_form_display('commerce_product', $product_type->id(), 'default')
      ->setComponent('variations', [
        'type' => 'inline_entity_form_complex',
        'weight' => 10,
        'settings' => [
          'override_labels' => TRUE,
          'label_singular' => 'variation',
          'label_plural' => 'variations',
        ],
      ])
      ->save();

Need something similar for the view mode.

harings_rob’s picture

Assigned: Unassigned » harings_rob
harings_rob’s picture

Status: Active » Needs review

Hi,

I have updated the code to set the default display.

I also added some helper function and cleaned up the deprecated calls.

https://github.com/drupalcommerce/commerce/pull/332

  • bojanz committed cdbab18 on 8.x-2.x authored by harings_rob
    Issue #2660280 by harings_rob, bojanz: New product types do not display...
bojanz’s picture

Status: Needs review » Fixed

Committed, thanks!

Status: Fixed » Closed (fixed)

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