• 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

Woocommerce Checkout - Add conditional field required if one field is filled

phpwordpresswoocommerceconditional-statements


PHP Snippet 1:

add_action( 'woocommerce_checkout_process', 'afm_validation' ); 
function afm_validation() {     
    if ( isset($_POST['wi_as_company']) && isset($_POST['billing_company_wi_id']) && empty($_POST['billing_company_wi_id']) ) {         
        wc_add_notice( __("Please fill company ID"), "error" );     
    }
 }

Related Snippets

Transpose and flatten multiple rows of array data [duplicate]

Yii2 select2 database exception number of bound variables does not match number of tokens

WooCommerce Subscriptions: Remove role on cancelled subscription

get data-value with variable value

NGINX: connect() to unix:/var/run/php7.2-fpm.sock failed (2: No such file or directory)

how to validate form data in codeigniter 4

Wordpress wpdb->delete issue

Filter WooCommerce related products by Polylang language

Get data from accuweather api url

Get image type from base64 encoded src string

The "client_reference_id" argument is not passed

oauth-private.key does not exist or is not readable

Composer Warning: openssl extension is missing. How to enable in WAMP

laravel 5.6 bulk inserting json data

PHP Imap , php 7.4.3 on mac osx catalina

About Contact Privacy policy Terms and conditions