Skip to content

Instantly share code, notes, and snippets.

@rwsite
Last active October 10, 2021 16:55
Show Gist options
  • Save rwsite/9bf120a5e35a18adb480e0b43ae03c07 to your computer and use it in GitHub Desktop.
Save rwsite/9bf120a5e35a18adb480e0b43ae03c07 to your computer and use it in GitHub Desktop.
woo2iiko default value for teminal's select
add_filter('iiko_checkout_fields', function ($fields){
$fields['delivery_terminal']['default'] = '';
$fields['delivery_terminal']['options'] = [''=>''] + $fields['delivery_terminal']['options'];
return $fields;
}, 10, 1 );
add_action( 'woocommerce_after_checkout_validation', function ($data, \WP_Error $errors) {
if(isset($data['billing_delivery_terminal']) && empty($data['billing_delivery_terminal'])){
$errors->add('iiko_terminal', __('Please select the terminal', 'iiko'));
}
return $data;
}, 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment