I‘v wordpress woocommerce store in the checkout page i’m using wc_print_notice to display notice basde on city field i’v two notices to display the first notice is “We will deliver your order soon” the second notice “Sorry can’t deliver to your city”
if ( is_admin() ) return $available_gateways;
// HERE define the allowed cities to delevery
$cities = array( 'jazan' ); // just one city other city can't reach to it yet
// Testing output (display a notice)
if ( in_array( WC()->customer->get_shipping_city(), $cities ) {
wc_print_notice( sprintf( 'We will deliver your order soon','succuss' );
return $available_gateways; // enabled payment method
}
else
{ wc_print_notice( sprintf( 'Sorry can't deliver to your city') , 'error' );
// disale payment method
}
the code work finely but if the customer select our city he see 1st notice if he select after that other city he see 2nd message And so on
i want to display one notice only not previously notics i want code to clear previous notices or relode page
The second issue is – How to disable place to odrer button rather than disable avilable payment gateway as shown in code
thanks to help.
