You are here

function commerce_order_update_8205 in Commerce Core 8.2

Add the 'total_paid' field to 'commerce_order' entities.

File

modules/order/commerce_order.install, line 101
Install, update and uninstall functions for the Order module.

Code

function commerce_order_update_8205() {
  $storage_definition = BaseFieldDefinition::create('commerce_price')
    ->setLabel(t('Total paid'))
    ->setDescription(t('The total paid price of the order.'))
    ->setDisplayConfigurable('form', FALSE)
    ->setDisplayConfigurable('view', TRUE);
  $update_manager = \Drupal::entityDefinitionUpdateManager();
  $update_manager
    ->installFieldStorageDefinition('total_paid', 'commerce_order', 'commerce_order', $storage_definition);
}