0

I'm settings up a shop with VAT and shipping. All works well except just one thing fails, when I include VAT in the shipping rate the price component displays the amount excluding taxes. But I want the full amount including taxes to be displayed. How can I achieve this?

1 Answer 1

1

This is happening because the "Order Total" process combines like price components together and then lists them out. As a result, the base shipping rate component is appearing unaltered and the VAT is being combined into any other product VAT (or shipping VAT) components. It's an unfortunate display side effect of the implementation of price components, but it's on the roadmap to be updated in Commerce 2.x.

In the meantime, your solution will involve implementing hook_commerce_price_formatted_components_alter(), which you can find documented in commerce_price.api.php. This is purely a display alteration, so all the necessary data will still be there unaltered - you can just fiddle with the display amounts of the price components so your VAT component gets added to your shipping component instead.

1
  • Thank you very much! :) For others with this problem: ` foreach ($components as &$component) { if($component['title'] == "Shipping" ){ $component['price']['amount'] += $component['price']['amount'] * 0.19; // for 19% VAT } } `
    – MrPinkey
    Commented May 28, 2013 at 14:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.