Partial Invoices & Refunds
Product Fees are stored on sales items and are automatically prorated by quantity for invoices and credit memos.
Partial Invoices
When creating an invoice for a subset of ordered quantity, fee amounts are calculated as:
fee_on_invoice_item = fee_on_order_item * (invoiced_qty / ordered_qty)The prorated values are written to invoice item fields:
base_productfee_amount,productfee_amountbase_productfee_tax_amount,productfee_tax_amountproductfee_applied_json,productfee_tax_json(copied from order item snapshot)
Partial Refunds (Credit Memos)
Credit memos use the same ratio logic:
fee_on_creditmemo_item = fee_on_order_item * (refunded_qty / ordered_qty)This keeps fee totals consistent across multiple partial invoices / refunds.
