vippsas/vipps-woocommerce

Shipping with ingrid - VAT falsely included, also some shipping methods missing

toronnet opened this issue · 3 comments

HI!

We're having some strange issues with our checkout/shipping on Vipps. For some reason VIPPS add 25% VAT to one of the methods. When paying with Klarna using the same shipping method, no VAT is added. Is there any option to disable VAT being added?

There's also one shipping method in Ingrid that doesn't show up in Vipps. Is it possible this has been excluded somewhere?

https://prnt.sc/TLAc6N2VdpMj

https://prnt.sc/b7SS8O-v4eHx¨

https://prnt.sc/MMHi-0NEjW9j

Shipping for Vipps Express Checkout and Vipps Checkout is processed in a special context triggered by a callback from Vipps to the server; which is different from what some shipping plugins expect - normally, they expect an geo-locatable IP belonging to the customer, an active session owned by the customer and an actual browser operated by the customer. Therefore you may see some problems with certain plugins; and it isn't always possible to support all of them.

To alleviate these issues, we do store the customers session in the order itself and reconstitute that from the order when calculating shipping; but the users personalia and location is set only to the data received by Vipps - the user is really "anonymous".

As for why VAT is added, that's internal to that shipping method, so I can't diagnose that specifically. You can however modify the shipping rates in the following filter:

$methods = apply_filters('woo_vipps_express_checkout_shipping_rates', $methods, $order, $acart);

This should return the WC_Shipping_Rate objects for the order and cart, and the session should be available. You could recalculate the rates here with no VAT, and add other methods if necessary.

For debugging, the earliest action where you have a Customer etc is

do_action('woo_vipps_shipping_details_before_cart_creation', $order, $vippsorderid, $vippsdata);

  • there is a cart at that point, so you can calculate shipping for it by creating a package and calling calculate_shipping. You can use the filter apply_filters('woo_vipps_shipping_callback_packages', array($package)); to debug that process.

Closed due to inaction. Possibly some recent changes in the handling of shipping on express checkout may have solved this.