Purchase flow
1- Sees a product
2- Clicks buy now (if not registered see register user)
3- Order is created with data (if we dont have the country we get it from API)
4- Redirect to checkout page. (theres a button next to VAT number (got VAT?) and Spain -- Edit goes to edit profile)
5- Checkout page will load the price with correct VAT, recalculates every time loading data from user and storing at model order VAT %, Country, City, address and VAT_Number
6- Checkout page appears pay buttons.
Register user (modal)
1- Receives a product ID by get/post
Name
Email
Country (gets from API) (not from drop down, case no country use USA)
2- Once created goes to 3 order creation (put alert to confirm email)
Edit profile (Billing details):
EU VAT Number, only will save this data if validated with API.
Save, country, city, address
After save redirect to checkout (we receive the order_id via get)
// If CloudFlare has already done the hard work, return their result (which is probably more accurate)
if (!empty($_SERVER["HTTP_CF_IPCOUNTRY"])) {
$country_info = $_SERVER["HTTP_CF_IPCOUNTRY"]);
}
else:
function ip_details($ip) {
$json = file_get_contents("http://ipinfo.io/{$ip}/json");
//http://freegeoip.net/json/IP
//http://ip-api.com/json/IP
//http://www.telize.com/geoip/IP
$details = json_decode($json);
return $details;
}
$details = ip_details("8.8.8.8");
echo $details->city; // => Mountain View
echo $details->country; // => US
echo $details->org; // => AS15169 Google Inc.
echo $details->hostname; // => google-public-dns-a.google.com
OR
https://github.com/maxmind/GeoIP2-php
``
Add a config to force the EU VAT compliance.
Purchase flow 1- Sees a product 2- Clicks buy now (if not registered see register user) 3- Order is created with data (if we dont have the country we get it from API) 4- Redirect to checkout page. (theres a button next to VAT number (got VAT?) and Spain -- Edit goes to edit profile) 5- Checkout page will load the price with correct VAT, recalculates every time loading data from user and storing at model order VAT %, Country, City, address and VAT_Number 6- Checkout page appears pay buttons.
Register user (modal) 1- Receives a product ID by get/post
Edit profile (Billing details):
My Purchases
Pay via bank transfer:
Country codes: https://gist.github.com/vxnick/380904
To validate the VAT number: https://github.com/herdani/vat-validation
To get a list of updated VAT by country: 'https://wceuvatcompliance.s3.amazonaws.com/rates.json', 'https://euvatrates.com/rates.json',
To detect the country: