jetpack
jetpack copied to clipboard
Sync: HPOS orders sync refunds incorrectly.
Impacted plugin
Jetpack, Backup
Quick summary
When a post of shop_order_refund
is synced, the total_amount
column value is always stored as 0.00
in the wc_orders
table. This needs to be corrected. The expected total_amount
value should be -1 * refund_amount
. The refund_amount
value is synced but is not stored.
Steps to reproduce
- Select an order that is synced already and has a status
Pending Payment
orOn hold
. - If such an order does not exist, please create a new order and verify it is synced.
- Let's assume the
total_amount
of the order is50.0000
. - In the WordPress admin panel, click on the order to edit.
- In the Order Edit screen, click the
Status
dropdown and selectRefunded
to refund the order entirely. - In the local database, verify a new record is created with
parent_order_id
as the ID of the order refunded. - Verify the
total_amount
column in the local database equals*1 * total_amount of the parent_order_id
. i.e.-50.0000
. - Check the record in the synced WPCOM table.
- The
total_amount
is set to0.00
.
A clear and concise description of what you expected to happen.
The total_amount
should not be zero and should be equal to the total amount of the parent order in negative.
What actually happened
The total_amount
is zero.
Impact
All
Available workarounds?
Yes, easy to implement
If the above answer is "Yes...", outline the workaround.
We can use the jetpack_sync_filtered_hpos_order_data
filter to set order_total
index which is saved as the total_amount
.
Platform (Simple and/or Atomic)
No response
Logs or notes
No response