You are here

function _commerce_webform_remove_required_product_from_order in Commerce Webform 7

Same name and namespace in other branches
  1. 8 commerce_webform.module \_commerce_webform_remove_required_product_from_order()
  2. 7.2 commerce_webform.module \_commerce_webform_remove_required_product_from_order()

Form submission function. Someone has tried to remove a required commerce webform item from an order. Remove all submission products at the same time.

1 string reference to '_commerce_webform_remove_required_product_from_order'
commerce_webform_form_views_form_commerce_cart_form_default_alter in ./commerce_webform.module
Implements hook_form_FORM_ID_alter(). Modify the cart modification form.

File

./commerce_webform.module, line 643
Commerce Webform module file

Code

function _commerce_webform_remove_required_product_from_order($form, &$form_state) {
  $removed_line_item_id = $form_state['triggering_element']['#line_item_id'];
  $removed_line_item = commerce_line_item_load($removed_line_item_id);
  $sid = entity_metadata_wrapper('commerce_line_item', $removed_line_item)->commerce_webform_sid
    ->value();
  if ($sid > 0) {
    _commerce_webform_remove_line_items_from_cart_form_by_sid($form, $form_state, $sid, $removed_line_item_id);
  }
}