• 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

Laravel Collections. Is there some kind of assertStructure method?

Add a text next to stock quantity if it is less than 10 in Woocommerce single product

PHP: Print caught exception like Xdebug

How to override htaccees file for cache control header

XML to CSV with PHP converter [problem with images grabing]

Error Class "LaravelFortifyFeatures" not found

calling server using nusoap with complextype

How to fix " Uncaught TypeError: Argument 1 passed to JpGraphException::defaultHandler() " problem in php 7.1.3 and jpgraph 4.2.6?

Remove product downloads section in woocommerce email notifications

The "client_reference_id" argument is not passed

PHP array_filter with arguments

PHP: Insert marker every 3 iterations

Fatal error: Uncaught mysqli_sql_exception: Unknown database 'test' in ... (How do I fix that? Using PHP)

target [LaravelFortifyContractsRegisterViewResponse] is not instantiable

PHPExcel export HTML table to xlsx

About Contact Privacy policy Terms and conditions