Skip to content

Commit cc223f0

Browse files
authored
Change the default state and country on the checkout in WC add
1 parent fa46a41 commit cc223f0

1 file changed

+29
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!-- This is a code snippets export file generated by the Code Snippets WordPress plugin. -->
3+
<!-- https://wordpress.org/plugins/code-snippets -->
4+
<!-- To import these snippets a WordPress site follow these steps: -->
5+
<!-- 1. Log in to that site as an administrator. -->
6+
<!-- 2. Install the Code Snippets plugin using the directions provided at the above link. -->
7+
<!-- 3. Go to 'Tools: Import' in the WordPress admin panel. -->
8+
<!-- 4. Click on the "Code Snippets" importer in the list -->
9+
<!-- 5. Upload this file using the form provided on that page. -->
10+
<!-- 6. Code Snippets will then import all of the snippets and associated information contained in this file into your site. -->
11+
<!-- 7. You will then have to visit the 'Snippets: All Snippets' admin menu and activate desired snippets. -->
12+
<!-- generator="Code Snippets/2.8.6" created="2017-09-05 17:07" -->
13+
<snippets>
14+
<snippet scope="2">
15+
<name>Change the default state and country on the checkout in WooCommerce</name>
16+
<desc></desc>
17+
<tags>woocommerce, change, default, state, country</tags>
18+
<code>add_filter( 'default_checkout_billing_country', 'change_default_checkout_country' );&#13;
19+
add_filter( 'default_checkout_billing_state', 'change_default_checkout_state' );&#13;
20+
&#13;
21+
function change_default_checkout_country() {&#13;
22+
return 'US'; // country code&#13;
23+
}&#13;
24+
&#13;
25+
function change_default_checkout_state() {&#13;
26+
return 'MI'; // state code&#13;
27+
}</code>
28+
</snippet>
29+
</snippets>

0 commit comments

Comments
 (0)