In commerce_pos.transaction.inc::commerce_pos_transaction_pay_submit(), there is logic to add a value to the line item's data:

  if (module_exists('commerce_pos_stock')) {
    $order = commerce_order_load($form_state['transaction']->orderId);
    $order_wrapper = entity_metadata_wrapper('commerce_order', $order);
    foreach ($order_wrapper->commerce_line_items->value() as $line_item) {
      if (!empty($form_state['input']['return_line_items'][$line_item->line_item_id]['commerce_pos_stock_add_to_stock'])) {
        $line_item->data['commerce_pos_stock_add_to_stock'] = $form_state['input']['return_line_items'][$line_item->line_item_id]['commerce_pos_stock_add_to_stock'];
        commerce_line_item_save($line_item);
      }
    }
  }

However, this is inside the block checking if the customer exists in the form state values:

  if (!empty($form_state['values']['transaction_options']['customer'])) {

I'm not sure if the customer will always exist in the form state, but either way, the stock change shouldn't rely on it.

Comments

mbreden created an issue. See original summary.

mbreden’s picture

Status: Active » Needs review

  • smccabe committed 5048471 on 7.x-2.x authored by mbreden
    Issue #2921376 by mbreden: Stock change logic on pay submit should be...
smccabe’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.