Woocommerce Cart Shipping Country
-
Hi,
For my client’s requirement I need to hide the European shipping methods. I have removed the European shipping zone through the admin section. In front end I need to show a custom message if there is no shipping methods allocated for the user if he set his shipping country as European country. For that I have created a custom message for the top error message in checkout page like below. This will trigger when the user clicks on “Place order” button.
add_filter( 'gettext', 'wbsuk_no_shipping_options_top', 10, 3 ); function wbsuk_no_shipping_options_top( $translated, $original, $domain ) { if ( $translated == 'No shipping method has been selected. Please double check your address, or contact us if you need any help.' ) { $translated = 'TEST MESSAGE'; } return $translated; }
But I am not getting the user shipping country. I have written a code in my plugin file and getting error if I use any of these.
if (strstr($current_rel_uri ,”/checkout”) != ”) {
$country = WC()->customer->get_shipping_country();
OR
global $woocommerce;
$woocommerce->customer->get_shipping_country();
}How to get the checkout user’s shipping country here? Please help me. Thanks.
The page I need help with: [log in to see the link]
- The topic ‘Woocommerce Cart Shipping Country’ is closed to new replies.