Skip to content

Conversation

@iamgabrielma
Copy link
Contributor

@iamgabrielma iamgabrielma commented Aug 12, 2021

Fixes #3845

Description

This PR removes the Issue Refund button from the Order Details screen if there's actually no refund to be done. This also fits with how the Android version works.

Changes

I have added an additional isEligibleForRefund check to the Order Details data source. This checks if the current order.total is positive. If the order.total is positive then the check will pass as there's something to be refunded, and we can load the cell for the refund button on this view.

Why use order.total for this check? This contains what a customer has effectively paid and sets the maximum that can be refunded, with coupons, shipping, fees, and taxes taken into consideration.

Hide button: Order details when refund is 0 Show button: Order details when refund is >0 Hide button: Order details when refund is 0 because negative prices Show button: Order details when partial refund
refund is 0, no button refund is positive, button refund is negative, no button partial refund, shows button

Edge Case: Refunding payment gateway fees:

At the moment I left the option to see the Refund Button if there's fees in the order, so when we have the case order.total = 0 && order.fees > 0 it will show the refund button, this is in consonance with how works in core: The button appears but is only possible to refund these fees directly through the payment gateway:

refund only fees

I believe we have 2 options here:

  • Option 1) Show the refund button when there's remaining fees, once the user taps on it we can edit the view to show "You need to manually issue the refund directly through your payment gateway" message.
  • Option 2) Hide the button, I'm not personally on board with this option as there's actually something that could still be refunded, just not through the app.

Work in progress

  • Is order.total updated after a partial refund?
  • Payment processor fees are added after the total. Should these be refundable as well? How does it work in WooCommerce core?

Testing steps

1 - Create an order where the price of the product(s) is equal to zero. One way to do this would be to add a sale price of zero for a product.
2 - Open the order in the app.
3 - Attempt to issue a refund for the order. The button is not there.
4 - Now try the same with an order where the price of the product is positive.
5 - Attempt to issue a refund for the order. The button will appear.

Update release notes:

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@iamgabrielma iamgabrielma added feature: order details Related to order details. feature: refunds Related to order refunds. category: parity Match what's supported by the other platform. labels Aug 12, 2021
@iamgabrielma iamgabrielma added this to the 7.4 milestone Aug 12, 2021
@peril-woocommerce
Copy link

peril-woocommerce bot commented Aug 12, 2021

You can trigger optional UI/connected tests for these changes by visiting CircleCI here.

@peril-woocommerce
Copy link

peril-woocommerce bot commented Aug 12, 2021

You can trigger an installable build for these changes by visiting CircleCI here.

@iamgabrielma iamgabrielma marked this pull request as ready for review August 12, 2021 07:21
@itsmeichigo itsmeichigo self-assigned this Aug 12, 2021
Copy link
Contributor

@itsmeichigo itsmeichigo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for fixing this - I really appreciate your informative description of the PR and all the cases taken into consideration for the fix. This works as expected ✅ - would you mind updating the RELEASE-NOTES.txt file with your fix? Thanks!

I have a non-blocking comment though - just a little nit-picking really 😅

@itsmeichigo itsmeichigo merged commit 47ea723 into develop Aug 12, 2021
@itsmeichigo itsmeichigo deleted the issue/3845-hide-refund-button-if-not-eligible branch August 12, 2021 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: parity Match what's supported by the other platform. feature: order details Related to order details. feature: refunds Related to order refunds.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refunds: consider hiding the option to refund if there is nothing to refund

3 participants