• 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

WooCommerce - unset "<product> removed notice…" on cart page

Make survey at laravel 5.4 and MySQL

SMTP "Error: DATA not accepted from server!" Opencart 2.3 on InMotionHosting

Star and Half Star Rating in Laravel

PHP echo values of all sub keys [duplicate]

How to write PHP in XSLT

how do i retrieve and display the alt text of an image in wordpress?

Display Link Title Instead of URL in XSL

Laravel s3 upload file with metadata using pre-signed url

Limit WooCommerce products in cart only from one custom taxonomy

How to remove Deprecated SymfonyComponentDebugDebugClassLoader?

Add customer email and phone in "Order" column to admin orders list on Woocommerce

How to validate Envato Purchase Code in PHP

PHP: How to solve ob_start() in combination imagepng() issue?

Insert a DIV after the 6th product only once in WooCommerce category archives

About Contact Privacy policy Terms and conditions