Comments

rar9’s picture

+1

longwave’s picture

Closed #1433954: Calculate shipping doesn't take into account taxes that apply to shipping costs as duplicate

I need to tax shipping according to 23% VAT. Thus I have to enter shipping costs without taxes when configuring shipping.

The problem is that calculated shipping costs show up without taxes. Taxes are added correctly after shipping which is fine but the problem is that calculated shipping costs aren't taxes inclusive where every other price is. This leads to lots of confusion, is there a way to show shipping costs taxes inclusive?

This still needs implementing as part of the inclusive taxes feature, so remains a feature request.

mitrpaka’s picture

One way of doing above feature request:

- Checkbox for "Include tax when displaying shipping quotes" added to Configuration » Shipping quotes
- Tax applied to shipping quote if checkbox enabled (default: FALSE) and tax applied for shipping

mitrpaka’s picture

Status: Active » Needs review
mitrpaka’s picture

Updated patch file
- Tax applied to shipping quote displayed in Estimated shipping cost pane in Shopping cart
- Checking added to check whether uc_taxes module enabled or not

tr’s picture

Status: Needs review » Needs work

Please remove the tabs and trailing whitespace in your patch. See http://drupal.org/coding-standards

We have a large number of test cases included with Ubercart to ensure inclusive taxes on products work properly. There should be additional test cases written as part of this patch to test inclusive taxes on shipping. Marking as "needs work" because of this.

christian death’s picture

Hi mitrpaka,

thanks for your work, it is work, but i found one problem.
The value price in function uc_quote_get_shipping_price_with_tax has this format, example 4,56€.
After the number 4 is a coma and not a point.
Problem is, calculation considered not the numbers after coma, in example 56.

This is my changes:

$quote_options[$key] = t('!label: !price', array('!label' => $quote['option_label'], '!price' => uc_quote_get_shipping_price_with_tax($quote['format'])));

to

$quote_options[$key] = t('!label: !price', array('!label' => $quote['option_label'], '!price' => uc_currency_format(uc_quote_get_shipping_price_with_tax($quote['rate']))));

and in function uc_checkout_pane_quotes

        $review[] = array('title' => $line_item['title'], 'data' => theme('uc_price', array('price' => $line_item['amount'])));

to

	$review[] = array('title' => $line_item['title'], 'data' => theme('uc_price', array('price' => uc_quote_get_shipping_price_with_tax($line_item['amount']))));

I hope this feature coming soon.

mitrpaka’s picture

#7: Patch doesn't take any side to decimal format. Please have a look at your format settings (By default decimal marker is . [dot], not comma)

christian death’s picture

Hi mitrpaka,

in germany decimal marker is comma, not dot.
In the code snippes from #7, i give the float value to your function uc_quote_get_shipping_price_with_tax and after the calculation i build the real currency string.
I think this is a better solution.

mitrpaka’s picture

In Ubercart you can define currency format in Configuration - Store - Currency Format (Select Decimal Marker to be comma, instead of dot)

... and as you stated already in #7, uc_quote_get_shipping_price_with_tax() function should return price as return uc_currency_format($price); in order to follow correct currency format set in the configuration.

Thank you for pointing that out.

Getting this feature to 7.x-3.x code line will take some time as pin-pointed in #6, but hopefully patch helps you to go forward with you site installation.

christian death’s picture

your patch was very helpful, i'm not a real php programmer and worked with this code is hard for me.
The problem is, TR will the patch only insert then this is in correct format and have test cases.
Can you help, create a fully functional patch, from your code, with my changes and a test case?
Or TR can you help us, so the feature come in the dev version of ubercart, please?

demoshane’s picture

Waiting for this aswell, as this is one of deal breakers in our store as we need to inform that all others prices are tax inclusive but shipping is tax 0%... It seems as scam to some according to feedback

bendikrb’s picture

The function uc_quote_get_shipping_price_with_tax() needs to filter the taxes based on the context of the order.
I have changed the function to:

/**
 * Returns shipping quote including tax.
 */
function uc_quote_get_shipping_price_with_tax($price, $order) {

  // Display shipping quote including tax (if enabled and tax applied)
  if (variable_get('uc_quote_display_include_tax', FALSE) && module_exists('uc_taxes')) {
    $tax_rates = uc_taxes_filter_rates($order);
    foreach ($tax_rates as $tax) {
      if (in_array('shipping', $tax->taxed_line_items)) {
        $price = $price * (1 + $tax->rate);
      }
    }
  }

  return $price;
}

And have done the changes as mentioned in #7, except of course passing both $price and $order to uc_quote_get_shipping_price_with_tax().

bendikrb’s picture

Ok, I did some more changes while I was at it, so that uc_quote_get_shipping_price_with_tax() behaves more in the same way that uc_taxes_get_included_tax() does.

Patch with all the changes (including the ones in uc_quote.admin) is attached.

tr’s picture

Still need to address #6 ...

bendikrb’s picture

Oh, sorry about that. Taken care of.

bendikrb’s picture

Atleast now it is (fixed a typo on line 719)...

mandreato’s picture

Status: Needs work » Reviewed & tested by the community

#17 worked for me.

tr’s picture

Status: Reviewed & tested by the community » Needs work

Still needs tests.

christian death’s picture

#17 also worked for me.

ebo1958’s picture

#17 also worked for me as far as calculating shipping goes. However, the line items are shown without tax. This is confusing because the same description is used in both instances. So, for example on my invoice, the customer expects to see Shipping including tax ( 2 EUR) but sees Shipping without tax added (1,68 EUR). Both have the label "Shipping in Germany". This means I would need to rearrange or customize the line items. The problem is that the shipping line item comes before the subtotal where tax is added so from this logic it is correct that the tax isn't included. I could work around this by structuring my invoice template as follows:
List of products with prices including tax
Shipping including tax
Grand Total
-------------
Line items with the breakdown

Is there a token that would spit out the "Shipping including tax"? Any help would be greatly appreciated.

mandreato’s picture

Just to say that #17 is on my live site since 4 months with no problems.

dfrt’s picture

Issue summary: View changes

Confirming the #17 patch to still work on Ubercart 7.x-3.6. It does not update the line item shipping price to tax inclusive, but this is better than nothing.

mcdoolz’s picture

#17 seems to work tickety boo.

Status: Needs work » Needs review
tr’s picture

Status: Needs review » Needs work

Even though the patch still applied, this issue should be needs work because of #6, #21, and #23.

grabby’s picture

Even if the patch worked it’s out of date by now with 7.x-3.11. Any chance someone could give this some love since it’s pretty important for VAT countries? I can’t code, but I can test.