Magento 2 – change shipping costs during checkout

You may also like...

12 Responses

  1. Pushpendra says:

    Thank you ! You save my life

  2. gh darvishani says:

    Thanks
    but i think we should use observer such as mg1
    for two week i searched for event observer but i does not find it
    i try your code

  3. Neeraj says:

    I create a custom shipping module. My custom shipping module is working fine. it is showing the price that I filled in the admin on cart or checkout page.
    Now I need to change a shipping price based on the pin code that user fill or choose in available shipping in magento 2.

    Can you please help me how can I do this.?

    • magemaster says:

      hey, the above example should do the trick, you need to extend \Magento\OfflineShipping\Model\Carrier\Tablerate and set shippingPrice to that value, your module gets from adminhtml (database)

      • Neeraj says:

        I can’t use the Tablerate shipping method because I need customer’s pin code to get the difference between the product’s available pin code and customer’s pin code.
        I need to run a API to find a shipping rate based on the pin code.

  4. Shipping Price is changing but not adding in GrandTotal.

    • magemaster says:

      if this happens, you need to re-collect totals for your quote object like:

  5. I am getting this error after overwrite model tablerate while i have ran setup upgrade command and remove var generation folder
    Fatal error: Uncaught TypeError: Argument 5 passed to Magento\OfflineShipping\Model\ResourceModel\Carrier\Tablerate::__construct() must be an instance of Magento\OfflineShipping\Model\Carrier\Tablerate, instance of Iksula\Checkoutcustomization\Model\Carrier\Tablerates given,

  6. ashar says:

    not working on magento 2.2

Leave a Reply