BigCommerce Troubleshooting

An order update adds a second product line

A PUT to an order adds a duplicate product line; include the existing order product id from Get Order Products, then verify lines and totals.

Last updated · Integrations and account operations · Applies to: REST Management API v2, Update an Order (PUT /v2/orders/{order_id})

Symptoms

  • You send a PUT to update an existing order to change a quantity, price or option, and the order now shows two lines for the same product instead of one changed line.
  • The original line is untouched and a new line appears with the values you sent.
  • Order totals go up instead of being adjusted, so the order no longer matches what the customer agreed to or what your ERP expects.
  • Running the same update again adds yet another line.
  • No error is returned. The request succeeds, which is why this often goes unnoticed until someone reviews the order or a reconciliation report.

Cause

The Update an Order endpoint (PUT /v2/orders/{order_id}) uses one field to decide whether a product entry is new or a change to an existing line: the order product id. BigCommerce's Update Order reference states that to add a product you omit the order product id, and to update a product you include it. If your payload leaves out id, the API treats the entry as a new line and adds it.

The most common way this happens is confusing two different IDs:

  • id on an order product is the "Numeric ID of this product within this order". It is created for each line item.
  • product_id is the catalog product's ID. Sending only product_id (and variant_id or product_options) describes which product to add, not which line to change.

Integrations that build the update payload from catalog data or from an ERP sales order line, rather than from the order's own line items, usually hit this. An older public Stack Overflow thread reports the same behaviour.

Resolution

  1. Stop retries first. If a job or queue is replaying the update, pause it so it does not keep adding lines while you fix the payload.
  2. Ask whether you need to touch products at all. If the integration only changes order status, send just status_id in the PUT body and leave the products array out entirely. The reference describes the endpoint as a partial update: send only the fields you want to change.
  3. Read the current lines. Call GET /v2/orders/{order_id}/products (see the Get Order Products reference). Note each line's id, product_id, variant_id and quantity. The default page size is 50, so page through results for large orders.
  4. Map your change to the existing line. In the PUT body, include the order product id for each line you are changing, plus only the fields you want to change. Per the reference, only the fields you send change.
  5. Clean up the duplicate line. To remove the extra line, send its order product id with quantity set to 0. The documentation notes the line stays on the order but no longer counts toward items_total or order totals. A negative quantity returns a 400 error naming the field, such as products[0].quantity, and the order is not changed.
  6. Check discounts. The reference says that when you change a line's quantity, price, variant, product, options or gift wrapping, the API removes all discounts and promotions from that line item. Decide whether that is acceptable before editing paid or discounted orders.
  7. Verify the fix. Read the order and its products back. Confirm there is one line per product, the quantities are right, and subtotal_inc_tax, total_tax, discount_amount and total_inc_tax match what you expect. Run the update a second time on a test order and confirm nothing new is added.

If the order still gains lines when you send a valid order product id, contact BigCommerce support with the store hash, order ID, the exact request body and the response.

How to prevent it

  • Always build order edits from a fresh read of the order's line items, never from catalog or ERP line data alone.
  • Store the BigCommerce order product id against each ERP sales order line when the order first syncs, so later edits can target the right line.
  • Make the update idempotent: compare the desired state with the current lines and send only the differences.
  • Test edits on a test order before using them on paid orders, and log the request and response for every order edit.

B2B and ERP considerations

In B2B, quantities often change after a sales rep or buyer reviews a purchase order. Because changed lines lose their discounts and promotions, a contract or price list discount applied at checkout may not survive an API edit. The reference advises syncing the order to any external system again after the update, so make sure your connector re-reads the order rather than assuming its own copy is correct.

If both your ERP and BigCommerce can edit orders, pick one system as the owner of line changes, so the two copies of the order do not drift apart.

More in the BigCommerce knowledge base, including every article on Integrations and account operations.