• Resolved blackbird69

    (@blackbird69)


    How do I prevent a purchase if the selected country and IP doesn’t match?

    I just installed the plugin, but so far I can’t see how to prevent VAT fraud. You can just change your country to a none-EU country and check out to avoid VAT even though the IP says the purchase was done from an EU country.

Viewing 1 replies (of 1 total)
  • Plugin Author Diego

    (@daigo75)

    At the moment, the EU VAT Assistant doesn’t include a “hard block” feature when there isn’t sufficient evidence to confirm customer’s location. In that scenario, the plugin simply asks the customer to self-certify their location. If the self-certification box is ticked, then the order can proceed.

    If you wish to block an order altogether when the country from the IP address doesn’t match the billing or shipping country, you will have to write a customisation for that purpose. That kind of customisation is outside the scope of the support service we can provide on this forum, but the following template should help you getting started:

    
    add_action('woocommerce_checkout_process', function() {
      $billing_country = $_POST['billing_country'];
      $shipping_country = $_POST['shipping_country'];
      $geolocation_country = \Aelia\WC\IP2Location::factory()->get_visitor_country();
      // Compare billing country and geolocation country. Raise an error if 
      // they don't match
      if($billing_country !== $geolocation_country) {
        wc_add_notice('Countries do not match', 'error');
      }
    });

    Should you need assistance implementing your custom logic, please feel free to contact us (https://aelia.co/contact) and we will get back to you with an estimate as soon as possible. Thanks.

Viewing 1 replies (of 1 total)
  • The topic ‘Prevent a purchase if country and IP doesn’t match?’ is closed to new replies.