From e940544a2a364ffae366ebbaa327cb5172af49a8 Mon Sep 17 00:00:00 2001 From: Nabeel Sulieman Date: Tue, 30 May 2017 14:11:11 -0700 Subject: [PATCH] Use Inches and Ounces as default measurement units when location is in US --- includes/admin/class-wc-admin-setup-wizard.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/includes/admin/class-wc-admin-setup-wizard.php b/includes/admin/class-wc-admin-setup-wizard.php index c8b49d04223..83c85ea0e26 100644 --- a/includes/admin/class-wc-admin-setup-wizard.php +++ b/includes/admin/class-wc-admin-setup-wizard.php @@ -510,8 +510,18 @@ class WC_Admin_Setup_Wizard { * Shipping. */ public function wc_setup_shipping() { - $dimension_unit = get_option( 'woocommerce_dimension_unit', 'cm' ); - $weight_unit = get_option( 'woocommerce_weight_unit', 'kg' ); + $dimension_unit = get_option( 'woocommerce_dimension_unit', false ); + $weight_unit = get_option( 'woocommerce_weight_unit', false ); + if ( false === $dimension_unit || false === $weight_unit ) { + $country = get_option( 'woocommerce_default_country', '' ); + if ( 0 === strpos( $country, 'US:' ) ) { + $dimension_unit = 'in'; + $weight_unit = 'oz'; + } else { + $dimension_unit = 'cm'; + $weight_unit = 'kg'; + } + } ?>