• Resolved kingturban

    (@kingturban)


    Hello,

    So I have a custom shipping method that calculates the shipping cost accordingly to user input in custom input fields on checkout page.

    The problem is that when they change values in custom input fields, the shipping cost doesn’t update. It only updates when user changes default woocommerce input field values like ‘shipping_city’.

    My custom input fields on the checkout page have html class ‘update_totals_on_change’. (Didnt find any documentation on it, but shipping_city had this class). Also I tried to call “wc_checkout_form.trigger_update_checkout()” function after input change, then It looked like it was loading but didn’t update the shipping cost. Then I tried to trigger “change” event on “shipping_city” input field when my custom input fields got changed, it again made it look like it was loading but shipping cost didn’t update. (Although this method was working when i was logged in as admin).

    Any tip or thought would be highly appreciated.
    Thank you!

    https://wordpress.org/plugins/woocommerce/

Viewing 1 replies (of 1 total)
  • Thread Starter kingturban

    (@kingturban)

    Just in case anybody should have the same problem in the future, it seems that the shipping debug mode only affects site admin. So I had to comment out the line 345 from class-wc-shipping.php where it checks if shipping needs to be recalculated.

Viewing 1 replies (of 1 total)
  • The topic ‘Custom shipping method not updating cart totals’ is closed to new replies.