
eswal200
Préstamo
Zeta
Verificación en dos pasos activada
Verificado por Whatsapp
Hola, tengo un codigo que me funciona bien, pero ahora necesito modificar para añadir varios paises pero no se como hacerlo.
Es para woocommerce.
alguien me podria ayudar?
aquí les dejo el codigo:
Grias
Es para woocommerce.
alguien me podria ayudar?
aquí les dejo el codigo:
Insertar CODE, HTML o PHP:
// from https://elliottrichmond.co.uk/woocommerce-how-to-make-a-user-exempt-from-tax-charges/
add_filter( 'woocommerce_checkout_fields' , 'billing_company_trigger_update_checkout_on_change', 10, 1 );
function billing_company_trigger_update_checkout_on_change( $fields ) {
$fields['billing']['billing_erers']['class'][] = 'update_totals_on_change';
return $fields;
}
add_action( 'woocommerce_checkout_update_order_review', 'checkout_vat_exempt_based_on_billing_company', 10, 1 );
function checkout_vat_exempt_based_on_billing_company( $post_data ) {
parse_str($post_data, $results); // Since Php 7.2, the 2nd argument is recommended in parse_str() function
extract($results);
$customer = WC()->customer;
// When billing company is filled and country is Croatia: Exempt taxes
if ( ! empty($billing_erers) && $billing_country === 'DE' && ! $customer->is_vat_exempt() ) {
$customer->set_is_vat_exempt( true );
}
elseif ( $customer->is_vat_exempt() ){
$customer->set_is_vat_exempt( false );
}
}
Grias