Adds lines to an unpaid or part-paid sale. This only adds lines — you can't remove or edit existing ones this way. For edits, deletes and adding lines in one request, use Edit sale lines.
A line with a negative quantity and no linked_sale_line_id is an adjustment line, and is allowed on unpaid and part-paid sales. Quantity can be positive or negative; it just can't be 0.
An unpaid return can also have lines added: that's a sale with a negative total, no payments and no linked return lines, usually stored as overpaid. Its status is recalculated and may become unpaid or overpaid. A sale that's a return or refund (it has lines linked to another sale) can't have lines added. Any other net-negative sale, such as one that already has payments, also can't.
Send an array of lines, or an object {"lines":[...]}. Each line has the same shape as lines on Create a sale: item_id or barcode, quantity, item_price, item_tax, item_discount, item_discount_reason, item_loyalty, item_promotions, serial_number and metadata. Promotions go in item_promotions (an array). The older item_promotion_id and item_promotion_name fields are used only when item_promotions is empty.
Don't include id on a line — that would be editing an existing line. Don't include linked_sale_line_id — returns can't be added to an existing sale this way.
The response is the updated sale, in the same shape as Get a sale. New lines get created, local_created and created_by set to now.
Adding lines fires a sale_lines_add system hook, and giftcard_create if any gift cards were created. If the add changes the sale's status, it also fires sale_update with {before, after}. If the sale becomes paid, each Inactive fulfillment is opened and a fulfillment_status_change hook fires with {before, after} for that fulfillment. Becoming overpaid doesn't open fulfillments. The sale_lines_add payload is {sale_id, lines, sale, before}: lines is only the lines that were added (with their new IDs), sale is the full sale after the change, and before is the sale before the change.
Required permission:
| Group | Permission |
|---|---|
| Sales | Create, edit and delete sales; manage = create sales and change their staff member or customer (includes view) |
