Skip to content

Instantly share code, notes, and snippets.

@bernattorras
Created May 15, 2019 09:29
Show Gist options
  • Save bernattorras/2e2f40c4a4a244cdfe078d8bb615f173 to your computer and use it in GitHub Desktop.
Save bernattorras/2e2f40c4a4a244cdfe078d8bb615f173 to your computer and use it in GitHub Desktop.
Enable EU VAT field when the current page contains a OPC form and the cart is empty
<?php
// Make sure that EU VAT Field is displayed on OPC pages (when the cart is empty)
function enable_eu_vat_field_opc_defualt( $default, $option, $passed_default ) {
if ( is_wcopc_checkout() ) {
return 'yes';
}
return $default;
}
add_filter( 'default_option_woocommerce_eu_vat_number_b2b', 'enable_eu_vat_field_opc_defualt', 11, 3 );
// Make sure that EU VAT Field is displayed on OPC pages (when the cart is empty)
function enable_eu_vat_field_opc_option( $value, $option ) {
if ( is_wcopc_checkout() ) {
return 'yes';
}
return $value;
}
add_filter( 'option_woocommerce_eu_vat_number_b2b', 'enable_eu_vat_field_opc_option', 11, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment