You are here

function commerce_discount_extra_update_7005 in Commerce Discount Extra 7

Add the necessary price field to the fixed product price offer type.

File

./commerce_discount_extra.install, line 649
Installs necessary fields for extra discounts.

Code

function commerce_discount_extra_update_7005() {
  field_info_cache_clear();
  $instances = field_info_instances();
  if (empty($instances['commerce_discount_offer']['fixed_product_price']['commerce_fixed_amount'])) {
    $instance = array(
      'field_name' => 'commerce_fixed_amount',
      'entity_type' => 'commerce_discount_offer',
      'bundle' => 'fixed_product_price',
      'label' => t('Fixed price'),
      'required' => TRUE,
      'widget' => array(
        'weight' => 4,
      ),
    );
    field_create_instance($instance);
    return st('Price field added to the fixed product price offer type.');
  }
  return st('Price field already existed on the fixed product price offer type.');
}