• Resolved yestube

    (@yestube)


    So I want to set my default shipping country to the US and have tried looking around the internet and found this code.

    add_filter( ‘default_checkout_billing_country’, ‘change_default_checkout_country’ );

    function change_default_checkout_country() {
    return ‘US’; // country code for United States
    }
    Sadly it does not work. is there a different way to do this?
    I first posted this on the woocommerce forms and they told me that I should come here to the plugin that I am using for my checkout page. Is there some edit I need to add to this code?

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi there,

    I’m assuming you are here because you are using the new checkout block included with the WooCommerce Blocks feature plugin.

    The Checkout Block does not support all the same functionality as the existing shortcode based checkout flow so that does mean that currently the filter you are using to change the default checkout country will not work.

    However, if you don’t mind the default country being the same as what is configured as the country for your store address, the block does respect the Default Customer Location option configured in the WooCommerce general settings page. Here’s a screenshot of the option: https://cln.sh/fssMGz

    If you configure the option to be “Shop base address” and your store address is what you want the default country to be, this should work well.

    I hope that helps!

    Thread Starter yestube

    (@yestube)

    i dont quite understand. can you clarify what you mean?

    Thread Starter yestube

    (@yestube)

    oh i see, so is there a way to get rid of the state field being filled in?

    Plugin Support Dani F. a11n

    (@danielinhou)

    Hi there,

    OK, so I guess that you have already achieved this because I see that your checkout page is already defaulting to the United States, Alabama.

    If you still need help with this, my colleague was suggesting to select the default country the same as what is configured as the country for your store address. You will need to do that under WooCommerce > Settings > General, just make sure to select Shop Base Address as Default customer location.

    I hope this helps.

    Cheers!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘can you set default shipping information?’ is closed to new replies.