0

I need to calculate shipping charge after discount is applied on cart subtotal

for example
cart subtotal: $170.00
Discount: -$15.00
Shipping: $17.00

Here i want it to calculate shipping charges after discount is added to cart subtotal,

for example
cart subtotal: $170.00
    Discount: -$15.00
    Shipping: $15.50

because it should first remove $15 from $170 and then it should calculate shipping charges from the remaining one.

Can you anyone please tell me the way to do this or any workaround for it

thanks in advance

1

I have added this in my custom shipping method, and it works for me. This should be added on your collectrates function inside your module.

$s_price = $request->getPackageValueWithDiscount();
$request->setPackageValue($s_price);
  • I can confirm this works. Except I was not using a custom shipping method, but standard Tablerate, for which I had to override Magento\OfflineShipping\Model\Carrier\Tablerate and add that line on 108. Tablerate is also what was selected in Cart by default when only one shipping method was available. For clarification: I am on Magento 2.1.10 – Jacques Feb 14 '18 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.