Skip to content

Commit afdfd97

Browse files
authored
Set WooCommerce default country as United States and the state as Michigan with the currency as USD by default Add
1 parent c7f72aa commit afdfd97

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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.9.4" created="2017-11-02 13:45" -->
13+
<snippets>
14+
<snippet scope="1">
15+
<name>Set WooCommerce default country as United States and the state as Michigan with the currency as USD by default</name>
16+
<desc></desc>
17+
<tags>default, country, state, setup, wizard, woocommerce</tags>
18+
<code>$option_name = 'woocommerce_default_country' ;&#13;
19+
$new_value = 'US:MI' ;&#13;
20+
$option_name = 'woocommerce_currency' ;&#13;
21+
$new_value = 'US' ;&#13;
22+
&#13;
23+
if ( get_option( $option_name ) !== false ) {&#13;
24+
&#13;
25+
// The option already exists, so we just update it.&#13;
26+
update_option( $option_name, $new_value );&#13;
27+
&#13;
28+
} else {&#13;
29+
&#13;
30+
// The option hasn't been added yet. We'll add it with $autoload set to 'no'.&#13;
31+
$deprecated = null;&#13;
32+
$autoload = 'no';&#13;
33+
add_option( $option_name, $new_value, $deprecated, $autoload );&#13;
34+
}</code>
35+
</snippet>
36+
</snippets>

0 commit comments

Comments
 (0)