Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

You can refund a 100% discounted shipment #252

Closed
blackshadev opened this issue Jan 29, 2021 · 1 comment · Fixed by #255
Closed

You can refund a 100% discounted shipment #252

blackshadev opened this issue Jan 29, 2021 · 1 comment · Fixed by #255

Comments

@blackshadev
Copy link

blackshadev commented Jan 29, 2021

context

At our webshop we have a promotion rule to discount the shipment of an order 100% if the order amount is above 30,-.
I noticed at the refunds menu, one can actually refund the full shipment costs even though it was 100% discounted.
I also checked if other promotions are being considered, which worked fine. So this seems specific to the shipment.

Reproduction

  • Add a promotional rule which 100% discounts shipping
  • Create an order (notice you have 100% discount on shipping)
  • Mark the order as paid
  • Go to the refunds page of said order
  • See you can refund the full price of the shipment

versions

  • sylius/refund-plugin: v1.0.0-RC.4
  • sylius/sylius: v1.8.8
  • sylius/plus: v0.32.0
@vasiliucatalinmihai
Copy link

Yep, same issue. The promotions on shipping are not considered.
As a fix I did this (maybe helps you):
In Sylius\RefundPlugin\Provider\RemainingTotalProvider::getRefundUnitTotal the shipment does not contains the promotions
so overwrite the method and replace
return $shipment->getAmount();

with

$order = $shipment->getAdjustable();
if ($order instanceof OrderInterface) {
      return $order->getShippingTotal();
}

return $shipment->getAmount();

also you need in your templates overwrite the vendor/sylius/refund-plugin/src/Resources/views/_shipping.html.twig replace shipment.amount with order.getShippingTotal at line 10 and 25.

Hope it helps :D

lchrusciel added a commit that referenced this issue Feb 15, 2021
This PR was merged into the 1.0-dev branch.

Discussion
----------

Fixes #252 and partially fixes (3rd point) #110

Commits
-------

4fa49c6 [Behat] Add scenario for refunding shipping cost with promotion applied
b80aafa Refund shipping cost with promotion applied
d5b8b63 [Behat] Add scenario for refunding shipping cost with 100% discount applied
a874a70 Fixes according to static analysis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants