function commerce_promotion_post_update_1 in Commerce Core 8.2
Add the coupons field to orders.
File
- modules/
promotion/ commerce_promotion.post_update.php, line 15 - Post update functions for Promotion.
Code
function commerce_promotion_post_update_1() {
$entity_definition_update = \Drupal::entityDefinitionUpdateManager();
$order_definition = $entity_definition_update
->getEntityType('commerce_order');
$fields = commerce_promotion_entity_base_field_info($order_definition);
$entity_definition_update
->installFieldStorageDefinition('coupons', 'commerce_order', 'commerce_promotion', $fields['coupons']);
}