php - woocommerce base location condition to match current user location -
i on this
basically have condition set customers outside base location in woocommerce
for instance, base location united kingdom
so how make condition this
if (user) = united kingdom { echo 'customer in uk'; } else { echo 'customer outside uk'; }
thanks
also how use this;
wc_get_customer_default_location() wc_get_base_location()
currently got , not working
$country_match = wc_get_customer_default_location(); echo 'your location ' . $country_match['country'] . '<br>'; if ( $country_match ) { $default = wc_get_base_location(); if ( $default['country'] !== $country_match ) { echo 'country match<br>'; } else { echo 'country not match<br>'; } if ( $default['state'] && $default['state'] !== $state ) { echo 'state match'; } else { echo 'state not match'; } } else { echo 'false'; }
Comments
Post a Comment