Jump to content

Welcome, Guest!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

30knees

Bug in EU Advanced Compliance with shipping taxes?

Recommended Posts

Hi, Could someone else please check that when enabled the EU Advanced Compliance module takes the shipping price and adds VAT on top of it? This is surprising for me and I don't know whether it's intended or not. I would expect the module to take the shipping price entered at the carrier as gross, i.e. including taxes, and not net. What would you expect?

Share this post


Link to post
Share on other sites

It's indeed intention! With enabled AEUC you have to be aware that shipping costs will be treated as tax included. But I can confirm this, tb treats the tax as net and adds the tax to shipping costs in checkout, really confusing. This is a bug!

Share this post


Link to post
Share on other sites

Thanks, @Occam! That means that if I have "Proportionate tax for shipping and wrapping" enabled the shipping rate will change dependent on the contents of the cart? Is there any way to fix this? That's really a big bug - we need to tell our customers in advance what the shipping rate is, but we can't if it's dynamic.

Share this post


Link to post
Share on other sites

Yep, I guess @mdekker just wasn't aware that AEUC treats the entered shipping fee as tax included. Which means, the calculation algorithm for the proportionate tax has to be slightly reworked.

Share this post


Link to post
Share on other sites

You can find the bug in function getPackageShippingCost of class Cart.php It starts absolutely right from line 1882:

       if (Configuration::get('PS_ATCP_SHIPWRAP')) {
            // With PS_ATCP_SHIPWRAP, pre-tax price is deduced
            // from post tax price, so no $carrier_tax here
            // even though it sounds weird.
            $carrierTax = 0;
            (...)

But it ends wrong from line 2003 on, because with AEUC option enabled the tax is added to the shipping costs and not deducted from this figure which would be correct:

    if (Configuration::get('PS_ATCP_SHIPWRAP')) {
        if ($useTax) {
            // With PS_ATCP_SHIPWRAP, we apply the proportionate tax rate to the shipping
            // costs. This is on purpose and required in many countries in the European Union.
            $shippingCost *= (1 + $this->getAverageProductsTaxRate());
        }

A workaround is quite simple. Just deactivate line 2007

    if (Configuration::get('PS_ATCP_SHIPWRAP')) {
        if ($useTax) {
            // With PS_ATCP_SHIPWRAP, we apply the proportionate tax rate to the shipping
            // costs. This is on purpose and required in many countries in the European Union.
            //$shippingCost *= (1 + $this->getAverageProductsTaxRate());
        }

Share this post


Link to post
Share on other sites

@mdekker I think generally you're right, though in Germany the legal opinion is divided whether displaying the shipping costs directly before the "Buy now" step is enough or whether you need to show them also before.

However, something else to take into consideration is that the link "Shipping excluded" (which should be changed to "plus shipping") next to the price on the product page leads to the shipping cost overview page. I don't think listing net shipping costs and explaining that the total will depend on a proportionate calculation makes sense.

Share this post


Link to post
Share on other sites

@30knees said in Bug in EU Advanced Compliance with shipping taxes?:

@mdekker I think generally you're right, though in Germany the legal opinion is divided whether displaying the shipping costs directly before the "Buy now" step is enough or whether you need to show them also before.

However, something else to take into consideration is that the link "Shipping excluded" (which should be changed to "plus shipping") next to the price on the product page leads to the shipping cost overview page. I don't think listing net shipping costs and explaining that the total will depend on a proportionate calculation makes sense.

At least in Germany in my opinion it should be ok when you show the exact shipping costs during the checkout process, because AEUC provides the link to shipping costs near every product price. You can avoid this irritating "free shipping" in the cart (as long as the shipping costs can not be calculated) by adding a boolean condition to hide this display when $is_logged is not true.

@mdekker There seems to be another bug in the proportianate taxes for shipping. If you have mixed taxes in the order and the quantity of products with the lower amount is greater than 1 the proportionate tax on shipping is the same as for the other tax rate, but negative. And btw there are problems with the invoice, too: 1. If you entered a base price for at least one of the products, instead of tax label/tax rates the base price is shown. But this should not be considered as alternative.

    {if isset($layout.before_discount)}
        <th class="product header small" width="{$layout.unit_price_tax_excl.width}%">{l s='Base price' pdf='true'} <br /> {l s='(Tax excl.)' pdf='true'}</th>
    {/if}

2. The variable $order_detail.total_price_tax_excl_including_ecotax contains the same as $order_detail.unit_price_tax_excl_before_specific_price. It's not the total amount!

Share this post


Link to post
Share on other sites

Is there a way to give eg Shipping costs a fixed tax rate regardless of the shopping cart contents until the bugs have been fixed? Ideally, the carrier prices would then always be incl. taxes of X%.

Share this post


Link to post
Share on other sites

Yes, but it's not an easy way. Or use a module like Presta plus. Not really cheap, but solid in programming and very useful. Works with thirty bees.

Share this post


Link to post
Share on other sites

@occam I'm revisiting this now because I'm testing the checkout flow prior to launching the shop with thirty bees. Does the Presta plus module solve all the issues of this thread? If so, I'd get it to move on with the shop.

Share this post


Link to post
Share on other sites

@30knees Technically yes, it should solve the bug. But as long as TB ignores overrides in this place, the clear answer is NO. It works fine with PrestaShop, but not with TB. Btw some of the additional features of PrestaPlus like individual delivery times (in stock and OOS) for every single product were implemented into PS 1.7 core last week.

Share this post


Link to post
Share on other sites

I wouldn't agree, because I cannot reproduce the behavior you were talking of at Github. My fix there from 2017 is currently implemented in a slightly different way to tb so that the workaround I posted is obsolete and outdated now.

        if (Configuration::get('PS_ATCP_SHIPWRAP')) {
            if ($useTax) {
                // With PS_ATCP_SHIPWRAP, we apply the proportionate tax rate to the shipping
                // costs. This is on purpose and required in many countries in the European Union.
                $shippingCost *= 1 + $this->getAverageProductsTaxRate();
            }
        } else {
            // Apply tax
            if ($useTax && isset($carrierTax)) {
                $shippingCost *= 1 + ($carrierTax / 100);
            }
        }

In my release issue-905 from Bleeding Edge it's line 2138-2149 in /classes/Cart.php. I tested it with both the standard invoice and my own invoice (adapted to tb). Each and every figure is correct.

Works fine. I guess there's else something causing your problems, provided that everything configured is properly.

  • Like 1

Share this post


Link to post
Share on other sites

Well, it's very encouraging that it works for you. I wonder where the issue could be. I'll fiddle around and try. I adapted your 2017 fix to the appropriate place in the new /classes/cart.php. For me, that starts at line 2169.

Share this post


Link to post
Share on other sites

Would you mind commenting whether this configuration is correct:

1. Disable AEUC.

2. Set tax rate for shipping.

3. Add shipping rate.

4. Enable AEUC.

5. Activate proportional calculation.

Share this post


Link to post
Share on other sites
1 hour ago, 30knees said:

Would you mind commenting whether this configuration is correct:

1. Disable AEUC. YES, otherwise you cannot disable the tax rate

2. Set tax rate for shipping. NO, delete it.

3. Add shipping rate.NO

4. Enable AEUC. YES

5. Activate proportional calculation. YES

Seems to me that it was a misconfiguration. Never set a shipping tax rate when you use AEUC (hopefully my own modified release)

Share this post


Link to post
Share on other sites
8 hours ago, Occam said:

AEUC (hopefully my own modified release)

Where can I find it? I checked here and on Github but didn't come across a release of yours.

8 hours ago, Occam said:

3. Add shipping rate.NO

So I add the shipping rate (cost) after I activate proportional calculation? 

Share this post


Link to post
Share on other sites

Nope, no shipping rate, just the shipping costs! Otherwise the proportional calculation wouldn't make sense.

Edited by Occam

Share this post


Link to post
Share on other sites

OK, so I deleted the carrier and entered it anew and it looks like it works! I'll keep an eye on it but: Thank you sooooo much. I'll post on Github, the fix needs to be implemented!

Share this post


Link to post
Share on other sites

Actually, I was too hasty. I still get this.

image.thumb.png.acfa53c6d015311602ded72dd278c2db.pngThe base price of the shipping is still tax included.

This is how my cart.php file looks:

  if (!Configuration::get('PS_ATCP_SHIPWRAP')) {
        //    if ($useTax) {
                // With PS_ATCP_SHIPWRAP, we apply the proportionate tax rate to the shipping
                // costs. This is on purpose and required in many countries in the European Union.
        //        $shippingCost *= 1 + $this->getAverageProductsTaxRate();
        //    }
       // } else {
            // Apply tax
            if ($useTax && isset($carrierTax)) {
                $shippingCost *= 1 + ($carrierTax / 100);
            }
        }
        $shippingCost = round($shippingCost, _TB_PRICE_DATABASE_PRECISION_);

Any ideas? 

As I said, I'm more than happy to pay someone and have this fixed and flow into the codebase. 

Share this post


Link to post
Share on other sites

@OccamI'm still struggling. Would you mind showing a screenshot of your invoice with a mixed basket and the tax rate, please? Thanks!

Share this post


Link to post
Share on other sites

Of course!

German invoice with  mixed taxes:  RE000019.pdf

And please, don't try to "approve" the Cart.php. Leave the code (where it deals with AEUC) like this:

 if (Configuration::get('PS_ATCP_SHIPWRAP')) {
            if ($useTax) {
                // With PS_ATCP_SHIPWRAP, we apply the proportionate tax rate to the shipping
                // costs. This is on purpose and required in many countries in the European Union.
                $shippingCost *= 1 + $this->getAverageProductsTaxRate();
            }
        } else {
            // Apply tax
            if ($useTax && isset($carrierTax)) {
                $shippingCost *= 1 + ($carrierTax / 100);
            }
        }
        $shippingCost = round($shippingCost, _TB_PRICE_DATABASE_PRECISION_);

        Cache::store($cacheId, $shippingCost);

        return $shippingCost;

 

Edited by Occam

Share this post


Link to post
Share on other sites

Thanks, will report back! So the only code modification you have is what you posted? Because then I totally misunderstood the suggested edits on Github. 

Edited by 30knees

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...