Created
May 15, 2019 09:29
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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