With include_tax_in_rrp set to TRUE the RRP price takes into account commerce_tax taxes but not commerce_eu_vat taxes.

This fixes it.

CommentFileSizeAuthor
fix_eu_vat.patch900 byteshlykos
Members fund testing for the Drupal project. Drupal Association Learn more

Comments

umadesign’s picture

Hi, I've just tested this patch and it seems that the VAT amount being added to the RRP is the VAT calculated AFTER the discount. Being a complete newbie on Drupal Commerce I developed a quick hack that seems to be working, although I'm sure this isn't the right way to do this. The changes are:

412a413,422
> 
>     // save VAT rate
>     foreach ($variables['price']['data']['components'] as $component_key => $component_value) {
>       $component_name = $component_value['name'];
>       if (substr($component_name, 0, 3) == 'vat') {
>         $vat_rate = $component_value['price']['data']['vat_rate_info']['rate'];
>       }
> 
>     }
> 
415a426,429
>       }elseif (substr($component_name, 0, 3) == 'vat') {
>         if (isset($vat_rate)) {
>           $rrp += $rrp * $vat_rate;
>         }

Complete code block:

  if ($variables['options']['include_tax_in_rrp'] == TRUE) {

    // save VAT rate
    foreach ($variables['price']['data']['components'] as $component_key => $component_value) {
      $component_name = $component_value['name'];
      if (substr($component_name, 0, 3) == 'vat') {
        $vat_rate = $component_value['price']['data']['vat_rate_info']['rate'];
      }

    }

    foreach ($variables['components'] as $component_name => $component_value) {
      if (substr($component_name, 0, 3) == 'tax') {
        $rrp += $component_value['price']['amount'];
      }elseif (substr($component_name, 0, 3) == 'vat') {
        if (isset($vat_rate)) {
          $rrp += $rrp * $vat_rate;
        }
      }
    }
  }

Hope this helps somehow

maxollerenshaw’s picture

Hi,

I applied the above patch to my site and it's worked OK for me. I did get an error saying hunk 2 failed on the patch, after reviewing the code all was correct and my prices are now displaying correctly.

After hacking my code to the same as #1 this has helped.

Thanks!
Max

Aambro’s picture

#1 worked for me so far!

WickedJ’s picture

#1 worked, in dev release
tested 2 but I've had an error and wrong rrp price.
committing?
Thx
J