You are here

function commerce_product_update_8204 in Commerce Core 8.2

Create the 'list_price' field.

File

modules/product/commerce_product.install, line 79
Install, update and uninstall functions for the Product module.

Code

function commerce_product_update_8204() {
  $definition_update_manager = \Drupal::entityDefinitionUpdateManager();
  $storage_definition = BaseFieldDefinition::create('commerce_price')
    ->setLabel(t('List price'))
    ->setDescription(t('The list price.'))
    ->setDisplayOptions('view', [
    'label' => 'above',
    'type' => 'commerce_price_default',
    'weight' => -1,
  ])
    ->setDisplayOptions('form', [
    'type' => 'commerce_list_price',
    'weight' => -1,
  ])
    ->setDisplayConfigurable('form', TRUE)
    ->setDisplayConfigurable('view', TRUE);
  $definition_update_manager
    ->installFieldStorageDefinition('list_price', 'commerce_product_variation', 'commerce_product', $storage_definition);
}