function commerce_shipping_update_7003 in Commerce Shipping 7
Same name and namespace in other branches
- 7.2 commerce_shipping.install \commerce_shipping_update_7003()
Rename shipping_method field on line item to commerce_shipping_method.
File
- ./
commerce_shipping.install, line 114 - Contains updade hooks for the commerce_shipping module.
Code
function commerce_shipping_update_7003(&$sandbox) {
commerce_shipping_line_item_configuration();
foreach (commerce_line_item_load_multiple(FALSE, array(
'type' => 'shipping',
)) as $line_item) {
$line_item_wrapper = entity_metadata_wrapper('commerce_line_item', $line_item);
if ($line_item_wrapper->shipping_method
->value()) {
$line_item_wrapper->commerce_shipping_method = $line_item_wrapper->shipping_method
->value();
}
$line_item_wrapper
->save();
}
field_delete_field('shipping_method');
}