I don't understand how our install is currently working, but we have incorrect plugin ID names for quantity and price.

    $fields['quantity'] = BaseFieldDefinition::create('decimal')
      ->setLabel(t('Quantity'))
      ->setDescription(t('The number of purchased units.'))
      ->setReadOnly(TRUE)
      ->setSetting('unsigned', TRUE)
      ->setDisplayOptions('form', [
        'type' => 'string',
        'weight' => 1,
      ])
      ->setDisplayConfigurable('form', TRUE)
      ->setDisplayConfigurable('view', TRUE);
    $fields['unit_price'] = BaseFieldDefinition::create('commerce_price')
      ->setLabel(t('Unit price'))
      ->setDescription(t('The price of a single unit.'))
      ->setRequired(TRUE)
      ->setDisplayOptions('form', [
        'type' => 'price_simple',
        'weight' => 2,
      ])
      ->setDisplayConfigurable('form', TRUE)
      ->setDisplayConfigurable('view', TRUE);

Both string and price_simple are not valid for the form display mode. It should be number and commerce_price_default

Comments

mglaman created an issue. See original summary.

mglaman’s picture

Status: Active » Needs review

  • mglaman committed 816b556 on 8.x-2.x
    Issue #2674840: Line item baseFieldDefinitions has bad field widget...
  • bojanz committed af241d3 on 8.x-2.x
    Merge pull request #339 from drupalcommerce/2674840
    
    Issue #2674840:...
mglaman’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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