• 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

401 Unauthorized only occurring on some pages in Laravel 8

merge all files in directory to one text file

Wordpress 'post_type_link' hides permalink

I'm trying to use curl with php but getting this error:Could not resolve host: Bearer

WooCommerce Subscriptions: Remove role on cancelled subscription

How to create a individual template for page or post in custom plugin?

array_map triple dimensional array [duplicate]

Xdebug can't connect back to Docker host

How to skip cart page on woocomerce for certain products only?

php file upload scanning using clamav, permissions on /tmp/

PHP rotate matrix counter-clockwise

Access denied for user 'homestead'@'localhost' (using password: YES)

Multiple order by in WooCommerce

Cache clear probem in Larave

Display the default discounted price and percentage on Woocommerce products

About Contact Privacy policy Terms and conditions