function commerce_discount_extra_update_7006 in Commerce Discount Extra 7
Replace the trigger and offer categories fields on per-quantity category offer types with textfields instead of lists.
File
- ./
commerce_discount_extra.install, line 676 - Installs necessary fields for extra discounts.
Code
function commerce_discount_extra_update_7006() {
// For each of the relevant off types...
foreach (array(
'per_quantity_category_fixed',
'per_quantity_category_percentage',
) as $bundle) {
// Delete the auto add behavior field as it is unnecessary.
$instance = field_info_instance('commerce_discount_offer', 'commerce_auto_add_behavior', $bundle);
field_delete_instance($instance, FALSE);
// Delete the trigger categories field.
$instance = field_info_instance('commerce_discount_offer', 'commerce_trigger_categories', $bundle);
field_delete_instance($instance);
// Delete the offer categories field.
$instance = field_info_instance('commerce_discount_offer', 'commerce_offer_categories', $bundle);
field_delete_instance($instance);
}
// No need to create the replacement fields as they'll be recreated when the
// caches are flushed post-update.
return st('The old trigger and offer categories fields have been deleted to be replaced by different field types.');
}