I managed to create my custom shipping method as flatrate with a custom module the shipping costs 5$.
I want to make it free if the cart total is more than 30$ for example.
Is there anyway to do this ?
I have no clue from where to start so I have no code to try please help.
Thanks !
2
Answers
Found it, In case someone needs this :
In my shipping.php file there is a function called collectRates which is reponsible for returning the shipping rates, I added
Basically If the total is more than 100$ I make the shipping price free, It would be better to make the 100$ a dynamic value which can be changed in the shipping method settings I will do it later.
this is my collectRates Function in the end:
You can set up Cart Rules to do this in your admin.
https://www.aitoc.com/blog/configuring-free-shipping-in-magento-2/