• 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

Apply filter array/return terms

Applying programmatically a coupon to an Order in WooCommerce3

phpMyAdmin ERROR: mysqli_real_connect(): (HY000/1045): Access denied for user 'pma'@'localhost' (using password: NO)

xdebug 3 not working in ubuntu 20.04 with docker

What is the difference between client-side and server-side programming?

how to make my own auto increment in php?

VB.NET WebRequest with PHP POST

How to create custom authentication in laravel 8?

How to test a php login connected to a mysql db through xampp?

Smarty if isset

How to solve Duplicate entry '0' for key 'PRIMARY' in Wordpress?

Laravel 4 Redirect::back() not going to previous page (refreshing current page)

Fatal error: Trait 'LaminasDbAdapterLaminasDbAdapterAdapterInterface' not found in /var/www/vendor/laminas/laminas-db/src/Adapter/Adapter.php

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

getting error while enter Command => php artisan route:list

About Contact Privacy policy Terms and conditions