I have a woocommerce store and it runs WPML so I can have different prices for Canadian or American customers because of different warehouses and costs.
It works great it changes the price and depending on if they select the US or CAN store but my problem is people in the US store can still select to ship to Canada and vice versa.
I need to change the code so that if they are in the "Canadian Store" (in other words they have Canada selected as their language) they can only select to ship to Canada and the same for the US store.
Can this be done by adding a php if statement to woocommerce-template.php where the below code normally is that basically says if WPML is set to US then the only country option is United States else the only option is Canada? If so what would the code be?
<select name="' . esc_attr( $key ) . '" id="' . esc_attr( $key ) . '" class="country_to_state country_select" ' . implode( ' ', $custom_attributes ) . '>
<option value="">'.__( 'Select a country…', 'woocommerce' ) .'</option>';
foreach ( $woocommerce->countries->get_allowed_countries() as $ckey => $cvalue )
$field .= '<option value="' . $ckey . '" '.selected( $value, $ckey, false ) .'>'.__( $cvalue, 'woocommerce' ) .'</option>';
$field .= '</select<>';