Sylius VAT based on delivery address - sylius

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.

Related

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

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.

Restrict customers being able to view a category/plp

What is the suggested approach to restrict a customer viewing a PLP, based on the user group assigned to the CategoryModel?
For example, let's say a category with code "c012345" is assigned to the user group "promoPreviewCustomers". I have two registered customers who are a part of the customergroup but only one customer is in the promoPreviewCustomers group.
Only the customer who is in a promoPreviewCustomers group, should be able to see the PLP of the category page c012345.
Our initial thought was to drive this through a personalisation rule within Commerce.
What are other people's thoughts on how this should be implemented within Spartacus, given that the product search API does not take into account the logged in customer?
Any restriction done only in Spartacus will be only for the UX as true restriction can only be done in the backend. Therefore, the best approach would be to drive this behavior with personalization within Commerce

Require 3rd party age verification in shopify

I have a requirement to do 3rd party age verification before I ship an order. I'm using a company called EVS for this. They released a shopify app recently, but seems partly baked. It requires a user to enter date of birth when registering for an account and then triggers the verification when the user places an order. The main problem with that is that it's rare for a customer to actually create an account before ordering for the first time -- instead they order first, then shopify emails them to create an account after the fact. Creating the account afterward does not allow the customer to enter DOB.
So I'm planning to implement my own solution. I can use EVS's API to run the verification by sending a combination of Name, Address, DOB, DL# and State, and last 4 of SSN. I have already built a proprietary order management system that pulls in customer and order data, and I can write a client to perform the verification.
I'm less savvy on the shopify side. I need to balance customer friction when placing an order for the first time, against having to do a lot of manual work for verification.
Below are the options I have conceived. Are there any other options? Any ideas for a better solution? Keep in mind I need to verify a customer once. I can tag the customer account as verified, and once verified it's business as usual.
Alter shopify templates to only show the checkout button when a user is logged in. If not logged in, show a "Create an account" button instead. That way the user provides DOB during account creation and the EVS app works as designed.
Set up a separate verification site like verify.my-domain.com. I can trigger an email to the customer upon order creation and ask them to verify. (May have issues with incorrect email addresses or spam filtering.)
If customer is not logged in, or account is not age verified, and they click Checkout, I can redirect them to a page. I can use a form on the page to do the verification. If verification passes, send them on to checkout.
For option 3, I don't know what shopify allows or what best practices allow. Can I use js to pass data to my own server on a different subdomain? Or post the form to another subdomain and then redirect back to shopify?
I'd appreciate any thoughts or suggestions.
You have pretty much summed up all your options, to clarify on them a little:
You can require that customers create an account in the store checkout settings. /admin/settings/checkout
This would work, you could iframe it in too on a custom Page. Or, better, use cross-domain calls or jsonp.
This is a little convoluted and you would have to persist and maintain lot of external state. I'd avoid this
I think a combination of 1 and 2. Turn on "require customer account". Modify the customer account creation page. Implement a cross domain policy with your server which will host custom code leveraging the EVS API.
I'm not sure if you are selling tangible goods or not but with stringent policies on users' age you have to bear in mind that shipping addresses could change. For a tight integration you should look at having webhooks whenever a customer is changed and make sure all their data is still valid since their last EVS approval.
I've been looking into this quite extensively and we've spent a number of hours experimenting with options. Our client in this case is on Shopify Plus so we do have the benefit of access to checkout.liquid.
Our research has led us to believe that one cannot pass the required 'customer note' of the date of birth to the checkout should they be attempting to checkout as a 'guest'. Perhaps because the 'customer' does not yet exist.
Our options have been narrowed down to:
Write a custom backend app that allows Shopify and EVS to communicate directly (XML API on the EVS side) in the checkout process or just prior and then pass the verification status back to Shopify to allow the order to proceed, or append some relevant status marker for the fulfillment department to act accordingly. The EVS app doesn't prevent the order from proceeding, but does flag the customer's age as unverified in the Risk Level panel in the admin. This would be quite a substantial project and by no means low hanging fruit. There is also risk of re-doing a lot of what the EVS app does already and running into they same obstacles they did.
Force customers to register prior to checkout (if not signed in). This seems the most viable approach. The only caveat being that existing customers will not have the customer note (birth date) and we'd need to build a smaller backend app to allow them to append this to their customer account via the Shopify API (this cannot be done via liquid).
These are our findings and I'd love to know more about how you ended up approaching this.

Paypal rest api express checkout with no shipping field (WebProfile handling)

I'm using Paypal rest api to make payment
the workflow is:
Create payment
Redirect to approval Url
User approved (return back to my site)
Execute payment
But there's one thing that I don't want users re-filling shipping address again because it was filled in my website.
So I change the workflow to:
Create web profile (set no shipping field)
Get web profile ID
Create payment with experienceProfileId given
Redirect to approval Url
User approved (return back to my site)
Execute payment
But I found this will create a lots WebProfile every time user request payment.
I think it is crazy to do:
create and delete it later again and again
attempt listing WebProfiles and check which is the one I want to use every time while creating payment
store experienceProfileId as a constant
What is the best practice for handling WebProfile or does there any solution just hiding shipping address while user approving payments?
Maybe this is not the answer regarding this "WebProfile". As a fact, I dont know what exactly "WebProfile" does or is.
I worked on the same Workflow these days. As you wrote I needed to predefine some address. For me it was obvious, that I have to do the database-stuff on my Website. Then I exactly define the order, shipping_address, etc. and send the users to Paypal.
If you predefine the new ShippingAddress() to your ´new ItemList()´ by
$itemlist->setShippingAddress($shippingaddress) the user cannot change it within the Process.
http://i.imgur.com/nAg8jxU.png
Maybe this helps you a little.

variable monthly charges to users

I have a situation where I am to bill the site users monthly. But the invoice amount that is raised depends on the the leads that our site generates for his business. For example if the user gets 5 leads from my site and I charge him $10 per lead, at the end of month he will be charged $50. similarly leads might vary each month so will the amount.
Now I cant store his cc/ paypal credentials on my site for security reasons nor can I pre bill him or ask him to take credits and then use it. Please let me know the way to handle this situation. How can I handle this using paypal?
There are a few different ways to handle this, but I would recommend Preapproved Payments, which are part of the Adaptive Payments API.
With this method your users would create a profile with you (using the Preapproval API) when they first create their account on your site. That will give you a preapproval key that you can store with your user account. Then in the future when you need to bill them you can use the Pay API with the preapproval key to process funds immediately without further approval.
If you're working with PHP my class library for PayPal will make these calls very simple for you. You would just use the Preapproval.php template to setup the profiles for people, and then use PayWithOptions.php to process payments using the preapproval key(s) accordingly.
If you end up using it and need more help you can contact me directly for support.