Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

How to Apply a Restocking Fee When Issuing Partial Refunds via API

How to Apply a Restocking Fee When Issuing Partial Refunds via API

oralunal
Shopify Partner
7 1 1

Suppose a customer placed an order as follows:

  • Product A - 1 unit - total $10 + tax
  • Product B - 2 units - total $50 + tax
  • Product C - 1 unit - total $40 + tax

The total payment with taxes was $120.

 

Later, the customer requested to cancel and refund 1 unit of Product B, which would normally result in a $25 + tax refund. However, I’m applying a 30% restocking fee, so the actual refund amount should be $17.5 + tax.

 

When using the API to calculate the refund, I can only define the line item and quantity. After that, I directly create the refund based on the calculation. How can I specify that the refund should be $17.5 instead of the full $25?

One day you will eat your last meal, you will smell your last flower, you will hug your friend for the last time. You might not know it's the last time, that's why you must do everything you love with passion.
Reply 1 (1)

sanjuthakur
Shopify Partner
7 1 2

A Cancel can happen in 2 ways 1) Store oversold the item hence left with no other option but to cancel 2) Customer called for a cancel. Typically restocking fee is applied during returns and if you have any returns integration like RETURNLY or LOOP RETURNS etc you can set the fee over there and achieve your requirement.

However if you want to do it yourself you may probably need to do via some backend Job (Java or something else) which can store in DB too. Because taking your case only If there are 2 items returned in same package you can charge restocking fee by lookup in DB (if its 1st time or not)