Musisz się zalogować, aby dodać opinię.
add_action( 'woocommerce_checkout_process', 'gierdaltech_allowed_city' ); function gierdaltech_allowed_city() { $disableCity = get_option('gierdaltech_settings_input_allowed_city'); if (isset($disableCity) && $disableCity != '') { $chosen_shipping = WC()->session->get( 'chosen_shipping_methods' )[0]; $chosen_shipping = explode(':', $chosen_shipping); $billingCity = isset( $_POST['billing_city'] ) ? trim( $_POST['billing_city'] ) : ''; // $billingCity = str_replace(array('-','_'),' ',$billingCity); $billingCity = strtoupper($billingCity); $disableCity = strtoupper($disableCity); if ($billingCity != $disableCity && $chosen_shipping[0] == 'flat_rate') { wc_add_notice( __( 'Nie znajdujesz się w regionie dostawy. Możesz zamówić i odebrać w lokalu.' ), 'error' ); } } } // add_action( 'woocommerce_checkout_process', 'webamator_validate_city' ); // function webamator_validate_city() { // $disableCityList = array ( // 'Sarasota County', // 'North Point', // 'Venice', // 'Longboat Key', // ); // $billingCity = isset( $_POST['billing_city'] ) ? trim( $_POST['billing_city'] ) : ''; // $billingCity = str_replace(array('-','_'),' ',$billingCity); // $billingCity = ucwords($billingCity); // if (in_array($billingCity, $disableCityList)) // { // wc_add_notice( __( 'Sorry, but we cannot ship to any city in Sarasota County' ), 'error' ); // } // }
Recenzje
Na razie nie ma opinii o produkcie.