
WooCommerce Checkout: Setting Default Billing State/Country
Enhance Checkout Efficiency with this Simple PGP Snippet for Setting Default Billing Country/State
Save your users valuable time during checkout and boost your conversion rate! This snippet has proven successful across multiple websites, allowing you to effortlessly set the default billing country or state. Ideal for businesses primarily catering to customers within a specific country or state. Enjoy the convenience it brings!
PHP snippet: Set Default Billing Country or State @ WooCommerce Checkout Page
// Example 1: default state to OREGON
add_filter(
'default_checkout_billing_state'
,
'bbloomer_change_default_checkout_state'
);
function
bbloomer_change_default_checkout_state() {
return
'OR'
;
// state code
}
// Example 2: default country to United States
add_filter(
'default_checkout_billing_country'
,
'bbloomer_change_default_checkout_country'
);
function
bbloomer_change_default_checkout_country() {
return
'US'
;
}