In my shopping card build using Magento2.4.2 , I need a dynamic calculation of shipping amount after going to next step after entering the shipping address. What I need is to make a third party api call to calculate shipping value based on address entered. I begin with the following URL but It gives a static shipping value only. I have attached the screenshot of step1 and step2 which will make some sense of what I need. I want to customise the module given in the link to achieve this. I have reffed many articles but could not find a solution. Someone please help to achieve this. The code I have added in same as in the link here

Step 1 : After entering address Screen 1

Step 2 : Before finalising payment. Here the shipping should not be 0 it should vary according to the address value enter image description here

Note: I can manage to do the third party call, leave it for me, What I need is to get is where to hook the magento to modify the shipping value.

Thanks in advance

2 Answers 2


Seems that your solution is to use table rate shipping method. It works fine for me.

Try reading this material https://docs.magento.com/user-guide/shipping/shipping-table-rate.html

Using the table rate, you may define how much a zip code(s) (neighborhood, city, state, country) will pay for the product. Possibilities are endless. Just need to add new lines.

Remember changing the Store View mode to download the file.

But, table rates are "fixed". You may also try installing a 3rd party plugin from your country to calculate the shipping cost. You may find some providers on magento store.


You can use magento's default tablerate shipping


still you want to add this logic in your custom module then open your shipping module and go to Model/Career.php or your Model file and add logic here as per your need.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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