Having started to set up a web site using Drupal Commerce with flat rate 7.1 and shipping 7.2 here in the UK, I have now found that the way Vat is shown to the customer is not the way we would expect to see it.
The calculation of the Vat is fine it's just the way it is displayed in the Review , Order history & email that is wrong.
below are three images to show how the orders are shown on screen.
For full details please see my other post below.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rfay’s picture

Title: Improvments to Flat Rate / Shipping » Improvements to Flat Rate / Shipping

Please make your feature request much more explicit. You'll need to say in words exactly what you want to do, if you would please. Otherwise, it's too hard to understand. Do you need more than one feature request? Please open a request for each.

remus1’s picture

Ok Randy let me try and explain.

This is not really a feature request but a problem with the way Commerce displays Vat that needs to be addressed before Commerce can be widely used in the UK straight from the box.

I think part of the problem is the differences between Vat on this side of the pond and the way sales taxes work on you side.

As an example lets take a product that cost £25.00 including Vat this is the way a retail customer would expect to see the item priced here in the UK.

Just to break this down the net price without Vat is 20.83 the Vat element is 4.17 = total 25.00

The delivery cost ( to you shipping) is £5.99 Including Vat. again a retail customer would expect to see the full delivery price.

Just to break this down the net price without Vat is 4.99 the Vat element is 1.00 = total 5.99

--------------------------------------------------------------------------------

So if you set up a produce to include vat at 20%. and a flat rate shipping charge again to include vat. When you get to the Review Order the shopping cart shows one item total cost 25.00

that's fine. the rest of the calculations are as follows.

Sub total 20.83

Vat 5.17

Delivery 4.99

Order total 30.99

This all adds up to the correct total of 30.99. But most general customers ( apart from business customers ) would not understand VAT. They will look at this and say I was told the delivery charge was 5.99.

What needs to happen is either

a. Change the Delivery/shipping label to sat Net of Vat. Problem with this is most customers would not understand what net means. Also having it after the vat field looks wrong. This idea will also not work when you get to the view your order screen (more on that later)

b. the better way to sort the problem out is before the sub total field to show the full delivery charge e.g 5.99 then have the sub total to include the net vat and net product totals

example.

product details 25.00

--------------------------------------------------------------------------------

delivery 5.99

Sub Total 25.82

Vat 5.17

Order total 30.99

This will then make it clear to the customer also if it is a business customer they have the correct vat for their accounts.

--------------------------------------------------------------------------------

That covers the Review order screen.

Now to the View my order screen. Here not only is the product purchased shown but also the delivery charge of 5.99. So you have

product 25.00

delivery 5.99

Sub total 20.83

vat 5.17

delivery 4.99

Order total 30.99

total confusion ! Customer will look at the on screen copy of their order and say 25.00 + 5.99 does not add up to 20.83. why have I been charged delivery of 5.99 and 4.99.

also if you were to change the delivery label as I said above this label is uses for both of the time delivery is shown. So the 5.99 and 4.99 charge would say net of vat.

answer to this one is to again show the net product and net vat as the subtotal and do away with the 4.99 delivery field.

--------------------------------------------------------------------------------

Last one is when the customer get the email copy of the order. As in the last example subtotal need to show net product and net vat.

Screen views of all these problems are show in the gifs on my first post.

hope this makes the problme Clear

Kevin

rfay’s picture

Title: Improvements to Flat Rate / Shipping » VAT Display of shipping is nonstandard
Project: Commerce Flat Rate » Commerce Shipping

Based on the description in #2 I'm going to move this to Commerce Shipping and change the title. I'd recommend that you rewrite the original post (create an issue summary by editing the node) before this matures too much farther. And it will be interesting to get Ryan to take a look at it, as he's been around and around with these things. I assure you that, as Commerce Guys is based in France, an enormous amount of energy has been put into making Commerce do tax that will hold up anywhere in the world. It sounds like in your opinion there's still some tweaking to be done.

remus1’s picture

Project: Commerce Shipping » Commerce Core
Issue summary: View changes

rfay requested that I give more details

rszrama’s picture

Project: Commerce Core » Commerce Shipping
Version: 7.x-1.x-dev » 7.x-2.x-dev
googletorp’s picture

I believe this mainly is about configuring the Views a bit differently (not display shipping line items on the completed order), and the price components on the email (Is that Commerce default even?)

remus1’s picture

I can see part of the problem on View Order could be solved by removing the shipping line item , but that still leaves the delivery price displaying wrong and the sub total not including the delivery element.
Also if you are suggesting removing the totals on the email. Can I just say that the emails sent to the customer and to the shop admin are one of the most important parts of the order.

Online shops that I have been involved with rely on the email being received to process the order. Most of the time I would only log onto the back office to mark the order as delivered.
The girls in the shop would not have any idea on how (or want to ) use the back office. They just check to see they have received two emails one from the online site with all the order details, e.g. items wanted . price, delivery name/address, delivery date, card message, any other instructions. The other email from SagePay to say payment is all ok.

ñull’s picture

Each European culture has its own interpretation of what is the right way to present VAT. In Spain you will find that many on-line shops show prices without VAT. Customers will only find out the total with VAT at checkout. For Spain probably the best would be to have the product line items displayed without VAT, Subtotal also without VAT. When shipping price is without VAT then it could be listed with the product line items and the Subtotal would include the shipping cost:

product line items without VAT
shipping without VAT
..........................................+
Subtotal without VAT
VAT
..........................................+
Total with VAT

If the shipping cost is with VAT included then you could rearrange it like this:

product line items without VAT
..........................................+
Subtotal without VAT
VAT
shipping with VAT
..........................................+
Total with VAT

The only way to make Commerce adaptable for all cultures is when the checkout views are as flexible as possible and when email / pdf / invoice output is part of views too.

At the moment it is one view with a "Commerce Order: Order total" as a hard coded footer field. May be instead it should be a "Global: View area" to allow adding or removing the shipping and other fees. ?

atlea’s picture

Found this issue looking to achieve the same as o.p. needs, only for the Norwegian marked. This is what (our) customers expect when the store show prices including VAT.

Customers who shop on a webshop showing prices including VAT don't need to see any prices excluding VAT at all, they just need to have the VAT specified on the order summary.

As a comparison, here is what I get from Magento out of the box:

  • Line item kr 100,00
  • Subtotal kr 100,00 <-- Subtotal is here inc. VAT, but ex. extras like shipping
  • Delivery kr 50,00 <-- Inc. VAT
  • VAT 25% kr 30,00 <-- Often this is written as "Including VAT 25%
  • Total kr 150,00

compared with Drupal Commerce (w/calculate a shipping rate added as trigger on VAT-rule):

  • Line item kr 100,00
  • Subtotal kr 80,00
  • VAT 25% kr 30,00
  • Delivery kr 40,00
  • Totalt kr 150,00

..when you are used to seeing summaries like the first one, this one is not very intuitive is it?

Atle
http://newreach.no

googletorp’s picture

Project: Commerce Shipping » Commerce Core
Version: 7.x-2.x-dev » 7.x-1.x-dev
Component: User interface » Tax

This has nothing with commerce shipping to do, but is about how commerce renders price components. The default rendering fits the american standard, but you could with your own theme function create a rendering that fits the scandinavian model - I have done so before.

I'm moving the issue to Commerce and we'll see how Ryan feels about this in core. This is very much related to how tax / prices should be displayed, with or without tax.

rszrama’s picture

Hmm, yeah, I actually always assumed you'd need to see the subtotal excluding VAT in Europe as well. Will have to watch my receipts more carefully next time I'm over there! I'm not particularly sure how to solve this in core, but one thing you can do is use hook_commerce_price_components_alter() to add your VAT back into your base_price (i.e. Subtotal) price component prior to display if you need. We may need to update the hook to pass more context information so this is only done for order totals. : ?

atlea’s picture

Well, your assumption was wrong. ;)

Either sites will show prices excluding vat, including, both, or let the user decide. But they all usually show tax as a separate component on summaries (some times only on receipts) and always show the total including tax.

To summarize, a site set up to display prices including VAT would also show subtotals and shipping including tax. And it would be better to have shipping listed before taxes on summaries. :)

I have no problem solving this using _alter and/or _theme-hooks, but this is a generic use case for countries with value added tax, so I think this is a feature worth requesting.

Atle

rszrama’s picture

Title: VAT Display of shipping is nonstandard » Provide the ability to include VAT (or other components) in the Subtotal display of price components

I think this is a better title. Feel free to tweak it, but it describes the issue as far as I understand it.

atlea’s picture

I don't feel comfortable tinkering with the price components directly, so am adding VAT in hook_commerce_price_formatted_components_alter.

Seems to solve my use case, so including it here in case others are looking to do the same.

I still think this should be added in a more generic way as a feature. :)

ps! Pricing rules need to make sure components are updated when manipulating line item prices.

function MYMODULE_commerce_price_formatted_components_alter(&$components, $item, $entity) {
  $tax_rates = commerce_tax_rates();
  
  foreach ($tax_rates as $tax_rate) {
    if ($tax_rate['type'] == 'vat') {
      if (isset($components['base_price'])) {
        // Add value added tax to the subtotal
        $amount = $components['base_price']['price']['amount'] * (1 + $tax_rate['rate']);
        $components['base_price']['price']['amount'] = commerce_tax_rate_round_amount($tax_rate, $amount);
      }
      if (isset($components['shipping'])) {
        // Add value added tax to the shipping
        $amount = $components['shipping']['price']['amount'] * (1 + $tax_rate['rate']);
        $components['shipping']['price']['amount'] = commerce_tax_rate_round_amount($tax_rate, $amount);
      }      
    }
  }   
}
function MYMODULE_commerce_price_component_type_info_alter(&$component_types) {
  if (isset($component_types['shipping']) && isset($component_types['base_price'])) {
    // Place shipping below base_price
    $component_types['shipping']['weight'] = $component_types['base_price']['weight'] + 1;
  }
}

edit: added rounding

rszrama’s picture

Not sure what you mean in your PS; they do do this, but you have to use the Line Item module's specific actions. Just using "Set a data value" won't do anything with the price components, as that action (and other generic actions) come from Rules, which knows nothing of our price component structure.

atlea’s picture

@rszrama: You have to select witch component a line item calculation rule affects, and can only select one - right?

So if for instance I want to provide a 50% discount on shipping when the order total exceeds a certain amount, I would have to run that rule on the shipping line item with shipping selected as component. If I run that rule after VAT/base_rate is calculated the VAT component will not be recalculated and be wrong. So one would have to run the VAT-rule last.

One implication is that you would need to set up the rules using ex. VAT amounts as triggers.

This was just an observation I made, not really related to the issue. So forgive me if it was out of context. :)

Happy holidays ;)

remus1’s picture

Many thanks Atlea
for posting the above code, it was a great help to a none expert.
I also agree that an answer to this problem should be built into commerce.

The only problem I had with the code was the second and third parts did not work when using the flat rate module.

So for anyone in the future, you need to replace $component_types['shipping']
with
$component_types['flat_rate_XXXXX'] where XXXX is the name you gave to your flat rate, mine was delivery.

thats part of the problem now solved
thanks again

muschpusch’s picture

The default rendering fits the american standard, but you could with your own theme function create a rendering that fits the scandinavian model - I have done so before.

@googletorp: Could you provide an example?

googletorp’s picture

#17 I haven't created something generic enough to be posted here.

muschpusch’s picture

Ah... maybe there is a solution:

http://drupal.org/project/commerce_price_components

Didn't test it but hope to do it tomorrow!!!! Thanks to pcambra giving me the tip on #drupal-commerce !

dannyjohnson1’s picture

@atlea Thanks a lot for the code above it was a great help!

The site I'm working on is a UK based wholesaler. Therefore, in my use case, I needed to show all product prices and delivery excluding VAT until the order summary page. Then display the details in the sequence:

  • Line Item 1 (ex-VAT
  • Line Item 2..... (ex-VAT)
  • Sub-total (ex-VAT)
  • Delivery (ex-VAT
  • VAT
  • TOTAL

Also useful was the hint above regarding tax on delivery accomplished by rules - add a "calculate a shipping rate" as trigger on the appropriate tax rule. In my case it was better to configure the UK VAT as a sales tax to avoid showing line item prices including VAT at any point.

Thanks again.

Danny
http://roadsignsdirect.co.uk

Juhani’s picture

Issue tags: +invoices
FileSize
23.5 KB
62.4 KB

In EU area there's some difference in valid invoice requirements, that vary by country and by business area (B2B, B2C, sales between EU-vat-area countries, sales to outside of EU-vat-area, sales inside a state, etc). Altought you have made your best effort, currenly Drupal Commerce (like Ubercart aswell) doesn't manage things correctly, unfortunately.

Might it be possible to map (with assistance of national financial management professionals), what is needed in each country, and then design a system that provides enough variables and flexibility so that you could provide valid invoice templates for each country. In Drupal Commerce, you've made a huge collection of different postal address formats for all the countries in the world, why not try do the same for invoice formats?

For example in Finland, tax administration requires that every invoice issued by a taxable person in accordance with section 209 b of the Value-Added Tax Act must set out the following particulars (otherwise it's not legal in Finland): http://www.vero.fi/en-US/Precise_information/Value_added_tax/Required_VAT_details_showing_on_invoices/VAT_details_to_set_out_on_sales_invoices

As attachment there's two example invoices, made by Finnish Tax Administration. Another example in xml format by Federation of Finnish Financial Services: http://www.fkl.fi/verkkolasku/yrityksen_verkkolasku/ladattavat/Tekniset%20tiedostot/mallit/yrityksen%20vl/Tieken_Testi1.xml

Another example: MyCashFlow is one of the most popular e-commerce softwares in Finland, and their fully customizable invoice templates can contain dozens of available variables to fulfill all the possible use cases: http://www.mycashflow.fi/english/interface/View:-Receipts

kiwimind’s picture

#13 is getting me very close, but I can't work in #16 to my shipping as I'm using multiple flat rate charges and applying them using rules according to the weight of the order.

Is there a generic shipping component reference that can be called?

atlea’s picture

Until there is a more generic solution, I guess you could do a string match for flat_rate_xxx?

function MYMODULE_commerce_price_formatted_components_alter(&$components, $item, $entity) {
  $tax_rates = commerce_tax_rates();
 
  foreach ($tax_rates as $tax_rate) {
    if ($tax_rate['type'] == 'vat') {
      if (isset($components['base_price'])) {
        // Add value added tax to the subtotal
        $amount = $components['base_price']['price']['amount'] * (1 + $tax_rate['rate']);
        $components['base_price']['price']['amount'] = commerce_tax_rate_round_amount($tax_rate, $amount);
      }
      foreach ($components as $component_name => $component) {
        if (strpos($component_name, 'flat_rate_') === 0) {
          // Add value added tax to flat rate shipping
          $amount = $components[$component_name]['price']['amount'] * (1 + $tax_rate['rate']);
          $components[$component_name]['price']['amount'] = commerce_tax_rate_round_amount($tax_rate, $amount);
        }
      }
    }
  }  
}
remus1’s picture

jibize’s picture

Thank you Ryan for pointing out hook_commerce_price_components_alter()!!

and thank you Atle for your snippet! However I was having discrepancies of 1p on some "base_price" using

$amount = $components['base_price']['price']['amount'] * (1 + $tax_rate['rate']);
$components['base_price']['price']['amount'] = commerce_tax_rate_round_amount($tax_rate, $amount);

So just in case someone is looking for an alternate solution though I think it is not as efficient as the Atle's snippet you can use

function MYMODULE_commerce_price_formatted_components_alter(&$components, $item, $entity) { 
  if (isset($components['base_price'])) {
    // Get the products total including VAT  
    $order_wrapper = entity_metadata_wrapper('commerce_order', $entity);
    $product_total = commerce_line_items_total($order_wrapper->commerce_line_items, commerce_product_line_item_types());

    // Set the Subtotal value
    $components['base_price']['price']['amount'] = $product_total['amount'];
  }

  $tax_rates = commerce_tax_rates();
  foreach ($tax_rates as $tax_rate) {
    if ($tax_rate['type'] == 'vat') {
      foreach ($components as $component_name => $component) {
        if (strpos($component_name, 'flat_rate_') === 0) {
          // Add value added tax to flat rate shipping
          $amount = $components[$component_name]['price']['amount'] * (1 + $tax_rate['rate']);
          $components[$component_name]['price']['amount'] = commerce_tax_rate_round_amount($tax_rate, $amount);
        }
      }
    }
  }  
}
remus1’s picture

Atle's code snippet sorts out the on screen display problem, but it would seem that commerce_email is picking up the line items before the changes take place.
Therefore if you want to send the customer a full copy of the order by email the Vat/subtotals are still wrong.

Any ideas how to change the email or make Atle's code work earlier.

atlea’s picture

@remus1: The code snipped does not actually change anything in the line items, just the formating of the components (display). I would suggest you create an issue in the commerce_email issue queue with a feature request to process component formating/printing through commerce_price_formatted_components.

remus1’s picture

Thanks Atlea
I have tried with commerce_email issues but know one seems to look at it very often. So not many questions get answers.

hacor’s picture

Hello All,

Sorry to reopen the subject, but I need some help regarding the weight of Shipping in the order checkout form. I followed the steps explained in post #13 and the flat rate changes in #16 but nothing changes on my checkout forms. I still have the following order:

- Subtotal
- Discount
- VAT
- Shipping
- Total

And I need conform to the Belgian law:

- Subtotal
- Discount
- Shipping
- VAT
- Total

I use 1 shipping method (flat_rate) with 3 shipping services:
- Machine name: afhalen (choosen when the client wants to pick-up the goods)
- Machine name: gratis_verzending (the client gets free shipping. Above a certain order total amount, organised by Rules)
- Machine name: verzenden_met_kost (when the client wants shipping and doesn't reaches the minimum for free shipping. Organised by rules)

I must honestly say that I don't have a lot of experience in PHP for the moment, but it's increasing every day.

This is the code I put in my theme's template.php (I only took flat_rate_verzenden_met_kost as a test but it doesn't change anything):

function MYMODULE_commerce_price_component_type_info_alter(&$component_types) {
  if (isset($component_types['flat_rate_verzenden_met_kost']) && isset($component_types['base_price'])) {
    // Place shipping below base_price
    $component_types['flat_rate_verzenden_met_kost']['weight'] = $component_types['base_price']['weight'] + 1;
  }
}

I hope someone can help!
Thanks in advance,
Best regards,

Hacor

remus1’s picture

Hi hacor
I have just checked back to see if anymore has been done to sort out the VAT problems, and have seen your post. I think the answer to your problem is that you have not put the code in your own module. You say that...I put in my theme's template.php ... I think you will find that you need to make your own module and replace the MYMODULE part of the name with yours, so if you call your module vat than the code will be
function vat_commerce_price_component_type_info_alter(&$component_types)

hope this helps

Stan Turyn’s picture

Removed

grn’s picture

Does anyone know the status on this issue?

Will it be implemented in a standard module?

Thanks.

Summit’s picture

Hi,
Can anyone post his module here? Like http://drupal.org/node/1352916#comment-5586682
And will this also add the subtotal, tax etc.. to the shopping card?
May be this helps to get this in commerce.
Thanks a lot in advance.
greetings, Martijn

Summit’s picture

FileSize
126.97 KB
1.14 KB

Hi I build a variant myself, see attachment and image that it doesn't add the VAT to the Card view.
Would someone please add it so that also in the Card the product without VAT and VAT are shown, like in the order. Thanks a lot in advance!
Greetings, Martijn

dwkitchen’s picture

Summit, I think this may help with what you are looking to do http://drupal.org/project/commerce_price_components

I plan to include a default VAT invoice in http://drupal.org/project/commerce_eu_vat, but haven't got to doing that yet.

rszrama’s picture

You can also just edit the View and change the area handler used in the footer to the one showing the order total with components.

Summit’s picture

Hi, How can I change the area handler used in the footer? I am not a programmer, sorry?
May be somebody can assist with this please? I see within the view only the Product Quantity and Order Total.
Thanks a lot in advance.
greetings, Martijn

rszrama’s picture

Edit the View, remove the current area handler, and add the new one. Just like if you were changing what fields were used in the View. It doesn't take any programming experience, just Views 3.x experience.

Horroshow’s picture

I tried to implement the code inside the commerce_price.api.php under hook_commerce_price_formatted_components_alter. I only used the part that change the weight of the shipping line and I changed the VAT for a sales tax instead.

  function MYMODULE_commerce_price_component_type_info_alter(&$component_types) {
    if (isset($component_types['flat_rate']) && isset($component_types['base_price'])) {
      // Place flat rate shipping below base_price
      $component_types['flat_rate']['weight'] = $component_types['base_price']['weight'] - 4;
    }
  }
  

Can someone help with the module creation? How can I do that? Many thanks!

Summit’s picture

Hi,
I try adding something in the footer handler, but I do not see any new options. So no VAT field is showing in the footer through views. Only options I see are:

Info
- producthoeveelheid (In English: quantity)
- Totaal (In English: total)

How do I get the VAT field in the footer-area please?
greetings, Martijn

Anonymous’s picture

Question posted Summit is kind of good one.)

There is no [line item summary] formatter available in views yet.
Only [item price] and [item total] have such formatter.

Anonymous’s picture

#40. Perhaps you can adopt Commerce Order: Order total.

majusz’s picture

Thanks for all the good ideas. Unfortunately none of the proposed ideas really worked for me because my shop is selling products with different VATs attached to them (books have 7% VAT included, non-books have 19%, according to German law).
So what happens when I try to use #23 or #25 is that BOTH VATs are added to Subtotal and Shipping, so the prices displayed are obviously wrong. You'd have to determine all the taxes contained in one single price item, but I couldn't find a solution for it by now.

Any suggestions? At the moment I decided not to display Subtotal at all rather than the "wrong" value, but that's not a permanent solution.
And in my opinion this is a really critical issue for Commerce, at least for productive use in Germany and probably many other countries with similar laws.

At least I managed to adjust the sorting of the items, so that the shipping costs are displayed above the included taxes now. Using 'MYMODULE_commerce_price_component_type_info_alter()' as proposed in #23 didn't work for me, so here's my solution for displaying all flat rate shipping items above taxes:

function MYMODULE_commerce_price_formatted_components_alter(&$components, $item, $entity) {
  if (isset($components['base_price'])) {
    foreach ($components as $component_name => $component) {
      if (strpos($component_name, 'flat_rate_') === 0) {
        $components[$component_name]['weight'] = $components['base_price']['weight'] + 1;
      }
    }
  }
}
Summit’s picture

Hi, could someone post a working custom module for the W
European way of showing which also works for
Commerce_email for order confirmation:

Likewise:
Product 1
Product 2
Etc..
Ordertotal (excl. VAT)
Shipping (excl. VAT)
VAT (counted VAT for Ordertotal and shipping)
Total incl. VAT

EDIT: #43 worked for this on the checkout screen!

Thanks a lot in advance!
Greetings, Martijn

Summit’s picture

Hi,
Anyone used https://drupal.org/project/commerce_eu_vat already?

Greetings, Martijn

Summit’s picture

Hi,
I have almost exactly what I want achieved within the checkout view right now.
The starting situation doing nothing is the following:

Product 1 Price inclusive TAX
Product 2 Price inclusive TAX
Subtotal without TAX
TAX
Shipping with TAX
Total Order

1) I used this patched module to only show the baseprice (without tax): https://drupal.org/node/1853988#comment-7770001 within the view price field.
2) I used the field Commerce Order: Order total (component) from that same module within the footer to choose the correct components.
3) Added the rule to calculate taxes on shipping: https://drupal.org/node/1243218#comment-7769985
4) Changed the order of components as such that Shipping without tax is shown before the tax: https://drupal.org/node/1352916#comment-7227810

My current checkout view shows:

Product 1 Price before TAX
Product 2 Price before TAX
Subtotal before TAX
Shipping before TAX
TAX
Total Order

I would very much like to add also Subtotal +shipping before tax before TAX, but do not know how to get that. If somebody can help me wih this great! Otherwise I leave it like this.

Greetings, Martijn

Summit’s picture

Issue summary: View changes

origanal message showing shipping 7.1 but using 7.2

IckZ’s picture

Issue summary: View changes

Hello erverbody!

Is there anything new about this topic or an comfortable way to mange the display of the checkout view / order mail view etc.?

I would like to display the prices like this:

Product 1 Price inkl TAX
Product 2 Price inkl TAX
Subtotal inkl TAX
Shipping

Total Order

Toal Order without TAX - TAX total

Any Ideas how to solve this?

francois_pilon’s picture

I do have the same need here. Any thoughts would be greatly appreciated. : )

oncreative’s picture

Has this still not been fixed yet? We're having the same issue and is wasting a lot of time to resolve.