Magento 2 – change shipping costs during checkout

You may also like...

9 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:

Leave a Reply

Your email address will not be published. Required fields are marked *