AdobeDocs / commerce-php

Source of the Commerce PHP Extensions guide
https://developer.adobe.com/commerce/php/
Other
7 stars 138 forks source link

The add new carrier example won't obey free shipping rules #227

Open ioweb-gr opened 9 months ago

ioweb-gr commented 9 months ago

Is there an existing issue for this?

What's missing?

In the guide for Add a custom shipping carrier https://developer.adobe.com/commerce/php/tutorials/frontend/custom-checkout/add-shipping-carrier/ it seems the example is missing critical functionality

The new carrier is added properly but it won't obey free shipping rules from cart rules because the collectTotals method is not accounting for that.

A fully working example should be given for a simple method to actually help developers build proper shipping methods.

If you could clarify this point it would help a lot.

pawan commented 7 months ago

@ioweb-gr @jeff-matthews I have checked and shipping method is working correctly and applying Shipping discount if there are any.

@ioweb-gr If you have issue with any specific type condition, let me know.

ioweb-gr commented 6 months ago

I had a fairly simple use case. One cart price rule which offers free shipping for the cart if it's above 60 EUR and the discount was not applying.

I then checked the code for the simple flat rate method shipped with magento and noticed that one is actually taking this into consideration separately

https://github.com/magento/magento2/blob/a98a64a73a72b7bb7bf297d3aba5f9920c8a2b70/app/code/Magento/OfflineShipping/Model/Carrier/Flatrate.php