If you need to inform your customers that you are unable to deliver a product for a particular area, use the following snippet.
add_action('woocommerce_after_cart', 'ts_check_selected_state',10,2); function ts_check_selected_state() { // Get the selected state $selected_state = WC()->customer->get_shipping_state(); // Check for unavailable states (adjust the array as needed) $unavailable_states = array('MP', 'KA', 'TN'); // Example list of unavailable states if (in_array($selected_state, $unavailable_states)) { wc_add_notice(sprintf(__('Delivery to %s is not available at the moment.', 'your-text-domain'), $selected_state), 'error'); } }
Output
The below output shows the warning area regarding the delivery of a product that cannot be done in a particular state.
![How to Add Message for Out-Of-Delivery Area Warning in WooCommerce Cart? 1 How to Add Message for Out-Of-Delivery Area Warning in WooCommerce Cart? - Tyche Softwares](https://media.tychesoftwares.com/wp-content/uploads/WooCommerce-Out-Of-Delivery-Area-in-Cart.png)
Additionally, you can also customize to display delivery day range based on shipping country in WooCommerce cart so that you can clearly inform customers about any changes in delivery estimates and ensure that your fulfillment processes match the customized delivery day ranges.