I have added a conditional action to add tax for all residents of NY state. Every time the checkout form is submitted we seem to add another tax line item to the order,wether there are errors or not. If you submit with a wrong credit card number,then with a missing address field,and then finally correct all info and submit you should now have 3 tax items in the review page. Table uc_orders_line_items also has 3 tax line items,looks like the item gets inserted every time the page is submitted.

Comments

jordan.aanei’s picture

The following fix worked for me :

File uc_order.line_item.inc , line 99 :

function uc_order_line_item_add($order_id, $type, $title, $amount, $weight = NULL, $data = NULL) {
  if (is_null($weight)) {
    $weight = _line_item_data($type, 'weight');
  }
  
//remove any previous duplicate tax line items for this order
  if ($type=='tax')
  {
  	db_query("DELETE FROM {uc_order_line_items} WHERE order_id=%d AND type='tax' AND title='%s'",$order_id,$title);
  }

  db_query("INSERT INTO {uc_order_line_items} (order_id, type, title, amount, weight, data) VALUES (%d, '%s', '%s', %f, %d, '%s')", $order_id, $type, $title, $amount, $weight, serialize($data));

  return TRUE;
}
Island Usurper’s picture

What do you mean by "added a conditional action"? By creating a tax rule, a conditional action predicate should be created for that tax automatically, and you just have to put conditions on it. You shouldn't have to add the action itself, because that would mean it happens twice.

Island Usurper’s picture

Status: Active » Postponed (maintainer needs more info)
tr’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

Closing because it seems likely that the OP caused the problem by creating a duplicate rule. Since there has been no follow-up in more than 6 months, and because no-one else has reported a similar problem in that time, I'm going to assume the OP figured it out.