Refund Sync Overview
When a WooCommerce order is refunded, WooSync automatically creates a Credit Note (return Sales Invoice) in ERPNext, maintaining accurate accounting records.
Triggering Refunds
Refunds are triggered when a WooCommerce order status changes to refunded (full refund) or when a partial refund is issued via the WooCommerce Orders screen.
Full Refunds
For a full refund:
- WooSync locates the original ERPNext Sales Invoice via the Caz Woo Order Mapping
- Creates a return Sales Invoice (
is_return = 1) linked to the original viareturn_against - The return invoice includes all original line items with negative quantities
- Optionally submits the credit note based on your store’s Auto Submit Sales Invoice setting
Partial Refunds
For a partial refund:
- WooSync creates a return Sales Invoice with a single “Refund Adjustment” line item for the partial refund amount
- The item code used is configurable in Caz Woo Settings
- The credit note is linked to the original invoice
Requirements
For refund sync to work, a Sales Invoice must already exist for the order. If accounting sync was not enabled when the order was first processed, WooSync will log a warning and skip the credit note creation. You can manually create the credit note in ERPNext in this case.
Idempotency
WooSync checks for existing return invoices (is_return = 1) linked to the original invoice before creating a new one, preventing duplicate credit notes from repeated webhook deliveries.