• Resolved ositaka

    (@ositaka)


    Hello, I am using your plugin to set the “is_vat_exempt” to “true” in case if a customer uploads a file.

    To be more clear, here is the main reason: In Belgium, if you are like a “lawyer” you can be “vat_exempt”, even if you don’t have a VAT Number. You have a certification instead to prove you are “vat_exempt”.

    So, I have been here looking for a solution and it’s kind of working… but I need a little help to see if I can accomplish this. You can take a look on this code and I think you will get my question.

    add_action( 'woocommerce_after_cart', 'checkout_vat_exempt_based_on_shipping_country', 10, 1 );
    
    function checkout_vat_exempt_based_on_shipping_country( $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;
    	$shipping_country = $customer->get_shipping_country();
    
        (...)
    	
    	if ( $shipping_country == 'BE' ) && $customer->alg_checkout_files_upload > 0 {
    		$customer->set_is_vat_exempt( true );
    	} 
    }

    How can I check if a customer has uploaded a file during the checkout? Something like this: $customer->alg_checkout_files_upload > 0 but I don’t know how to do it.

    Could you help me please? Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to check if $customer has uploaded a file (to set vat_exempt)’ is closed to new replies.