• Resolved arrowheader

    (@gauchan)


    Is there a code to remove the default State that is selected from the Shipping Calculator section in the WooCommerce cart. I was able to remove the default State from the CHECKOUT page using the following code and it works great but it still does not remove it from the Cart Total Shipping calculator.

    Screenshot here:
    https://prnt.sc/12qdxul

    This is the code I used to remove the default State from Checkout.

    add_filter( ‘default_checkout_billing_state’, ‘change_default_checkout_state’ );
    add_filter( ‘default_checkout_shipping_state’, ‘change_default_checkout_state’ );
    function change_default_checkout_state() {
    return ”;
    }

    • This topic was modified 3 years, 6 months ago by arrowheader.
    • This topic was modified 3 years, 6 months ago by arrowheader.
Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support abwaita a11n

    (@abwaita)

    Hi @gauchan,

    Just to suggest an alternative to the custom code, you’d want to consider setting “Default Customer Location” to “No Location by Default” in WooCommerce → Settings under General Options. This way, there’s no state is shown until a customer enters their address.

    *You can disable shipping calculation on the cart page altogether at WooCommerce → Settings → Shipping → Shipping Options

    That said, I’ll keep the thread open for anyone able to assist with the custom code to achieve your goals.

    Hope this helps in the meantime.

    Thanks.

    Thread Starter arrowheader

    (@gauchan)

    Thank you @abwaita. Since the merchant ships worldwide, they would probably want this option (as it allows the user to see what the shipping costs are for their country before proceeding to the checkout page). However, I will definitely keep this as an option.

    Thread Starter arrowheader

    (@gauchan)

    @abwaita Actually, I did try the 1st option you suggested and I think that might work as it leaves the shipping calculator blank and the buyer will need to choose the Country/State, which is carried over to the Checkout page. One issue I am having is that now, it’s showing the rate that is there for international buyers and using that total before the buyer even has had the chance to enter the Shipping Country/State? Do you know how to resolve this or disable that to show by default?

    Screenshot here: https://prnt.sc/12s5q2y

    Plugin Support abwaita a11n

    (@abwaita)

    Hi @gauchan,

    Good to hear about the progress.

    To mitigate the current issue, you can go to WooCommerce → Settings → Shipping > Shipping Options and check the box “Hide shipping costs until an address is entered”

    Let us know how it goes.

    Thanks.

    Thread Starter arrowheader

    (@gauchan)

    @abwaita That worked great. Thank you so much!

    One last question, is there an easy way to make USA the default country in the shipping calculator or make it the first option in the drop-down? That is because 99% buyers are USA buyers.

    Plugin Support abwaita a11n

    (@abwaita)

    Glad that it worked.

    Well, there are two ways to proceed here.

    1. You could set Default customer location to “Geolocate” or “Shop Base Address” (if your shop store address is in the US) at Woocommerce → Settings → General.

    2. The other alternative would be setting US as the default checkout country. You’ll want to use custom code provided in this documentation: https://docs.woocommerce.com/document/change-the-default-state-and-country-on-the-checkout/
    **You may want to comment out your earlier code, if you already haven’t.

    Hope that this helps as well.

    Thanks.

    Plugin Support abwaita a11n

    (@abwaita)

    Hi @gauchan,

    Just a heads up, I’ll go ahead and mark this thread as resolved as it’s been inactive for a bit. Hopefully, the above info was helpful!

    Please feel free to create a new thread if you have further questions.

    Cheers!

    Thread Starter arrowheader

    (@gauchan)

    Sounds good. Thank you @abwaita

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Remove Default STATE from Shipping Calculator in the cart’ is closed to new replies.