Prestashop - Optional VAT number for delivery address but mandatory for invoicing - prestashop

I am using Prestashop 1.7 and I need to make the VAT number only mandatory for billing addresses, but optional for delivery addresses. This is because many of the clients of my store are professionals/companies that need to have the VAT on the invoice, but who send the product directly to their clients from our platform, so they do not have to enter/know the CIF of the client that receives the shipment.
I've searched but can't find anything, so I've tried to do it myself, but I don't get full functionality.
This is what I have done so far:
I marked vat_number as non-mandatory in the Clients->Addresses backend section to be able to control the mandatory nature of the field during the purchase process.
In the payment process (Addresses step), if the customer uses the same address for delivery and invoice, I force him to enter a VAT number.
However, if they use different addresses, I force them to enter a VAT number for the invoicing address only and allow them to leave empty that field in the delivery address.
In the "Your invoicing address" subsection of the "Addresses" section, I disable the addresses that do not have the CIF filled in so that the customer cannot select them.
The problem is this: if the customer goes to their personal "Addresses" section and removes the VAT number from the address used for the invoice (they can do that because I had to mark the field as not required for it to work) and goes back to the checkout process, Prestashop goes directly to the next step (Delivery Method) and allows them to continue with the checkout process and the result is an order with an invoicing address without the VAT number.
Is there any native Prestashop way to do this or any module?
Or does anyone know how can I detect in the "Delivery method" step which addresses the customer has selected and force them to go through the "Addresses" step if there isn't any VAT number in the invoicing address?
Thank you very much

You would have to make your own module for this.
But you need the VAT number for delivery address and not billing address if you want to delivery VAT free according to a intra-Community supply order. Maybe check this (free) module.
If you are going to make a module for this, start with the hookActionValidateCustomerAddressForm hook.

Related

Validation of tax number through Xero API

I have been struggling for some time whether there is a way to validate if given tax number is a correct one. I have a form where customers enter their invoice data, but we create the invoice in the system when the payment arrives on our bank account.
That means if the vat id is wrong, Xero will return an error when create an invoice. I would like to validate the tax number on invoice data form, instead.
I have checked the API documentation, but I couldn't find anything there. Am I missing something?
I have an app that sends the contact informatiuon to Xero, and validate the VAT numbers first.
I do this using the VIES VAT SOAP Service.
https://www.programmableweb.com/api/vies-vat
http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl
My code is in c#, so I just created a web reference via the wsdl and call it with the countryCode and vatNumber arguments.
You can also use https://tin-check.com/en/
They have an API that validate tax number for more than 100 countries
https://api.tin-check.com/
Migth be a good alternative solution.

How to verify that guest email is already exist as customer in system on checkout page in Shopify

We need to add feature in Shopify that guest/customer can't purchase the product more then limit defined in product meta field in CMS.
Basically, we have limited edition of product so want that single person [email verification] can purchase 1-2 quantity in life time.
For this we tried following ways:
Webhook: But not able to find solution to show error on checkout page and stop order if we found such condition.
Custom code on template itself: But we are not able to verify email from CMS that its already attached to a customer otherwise we will get all orders of that customers and then products and matched with current cart product and show error message
Don't allow guest checkouts. Force your customers to login with an email. Them you can be certain of not allowing them to checkout with more than the one or two of these products in their lifetime. Otherwise, accept their order and simply cancel/refund the cheaters.

Sylius VAT based on delivery address

I'm trying to evaluate Sylius as a replacement for an existing shop system. However, I was unable to find an option on the demo system where Sylius calculates VAT based on the user's delivery address. Additionally, the VAT is not displayed in the frontend. How can this be configured?
If you want to show product based on address in frontend that would be little tricky, I think best way is to create custom channel. Then detect user location and show proper channel (maybe subdomain) - in any case for this you need to know user location. We resolved this in one project with asking him at the begining then store to cookie or account if he is logged in.
Regarding tax based on address in checkout that is possible, tax is very flexible and it is related to type of products (category) or location, so you can create different tax for different countries and this will be updated in checkout process after user decide where to deliver it.

How to get custom fields like Invoice number to show on Paypal receipts

We are using PayPal website payment pro and we can send money live and all is well.
Our issues are:
when we view the recent payment, it should say "payment from John Smith"...but ours just say "payment from". the name of the person does not show up. well our accounting section wants it back. :-) not sure why its not or which parameter of the DoDirectPayment request I need for this.
The user submission form has an invoice number field. I also need the invoice number to show on the details page of the PayPal payment receipt. I was able to get stuff like shipping address to show up by using its parameter, but no idea to have Invoice Number show up.
I know it can be done because the old website had these and they used website payments pro API to send payments. I just am not sure of how to do this. thee is no mention of this in the API references that I see, especially for DoDirectPayments method. Any help appreciated
Norman

Paypal Express Checkout for Payflow Pro, Shipping and Tax update

In our scenario, we will use PayPal Express Checkout for Payflow Pro (important as it's different from PayPal Express Checkout).
Based on documentation, https://www.paypalobjects.com/webstatic/en_US/developer/docs/pdf/pfp_expresscheckout_pp.pdf, we have to provide shipping and tax values prior to knowing customer's Shipping Address.
I think it's not practical at all, so my question - Is it possible to Update (SetExpressCheckout with existing token) shipping/tax amount after address is chosen? Or somehow update (aka Instant Updates) shipping/tax values on PayPal pages?
Also if customer will go back to shopping cart page and add/remove products should customer go back to PayPal pages or we can only update Item Information and DoExpressCheckout with new amount?
The usual, most general-purpose recommended EC flow is:
Customer is on "View Cart" page and clicks the Checkout with PayPal button without having entered any address or other information into your site
SetEC with provisional shipping/tax amounts (could be 0)
Redirect customer to PayPal site
Customer chooses shipping address at PayPal and returns
GetEC to find out their selected address for the first time
Calculate any new shipping or tax and display summary on an "order review" type page (which could allow them to select from multiple shipping options, like air/ground, if applicable)
When the customer clicks a final "Place Order" sort of button, DoEC with the updated shipping and tax amounts.
Caveat: by default the total amount of the DoEC must be within 115% or $75 of the original SetEC amount, whichever is lesser. So if any of your pricing scenarios will exceed that threshold, the original SetEC should include some placeholder Shipping and Tax amounts, so that the final total is within 115%/$75.