• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

Make Shipping Method fields Mandatory on Woocommerce checkout page

phpwordpresswoocommercecheckoutshipping


PHP Snippet 1:

// Validate shipping method fields and returning an error if none is choosed
add_action( 'woocommerce_checkout_process', 'shipping_method_validation', 20 );
function shipping_method_validation() {
    if ( ! isset( $_POST['shipping_method[0]'] ) ){
        wc_add_notice( __( "You need to choose your a shipping option.", "woocommerce" ), 'error' );
    }
}

Related Snippets

Center point of multiple gps coordinates with php

How to get transaction details in notify_url page in paypal

MySQL default time format UTC or GMT?

find in set in laravel ? example

Use Python plotly chart in PHP

woocommerce change position of price

Undefined Array Key error when uploading image on php

Laravel - Browser displays message again when I press back button

Remove country code from phone number?

WordPress ACFNotice: get_field() - We've detected one or more calls to retrieve ACF field values before ACF has been initialized

Store / Website Column in Magento 2 Admin Grid - Custom Module

Getting values for an enum?

How to get rid of ampersand using WP Nonce URL and WP Redirect or PHP header

Shortcode or PHP inside a shortcode in Wordpress

unable to load your default controller on Codeigniter

About Contact Privacy policy Terms and conditions