13 replies [Last post]
teksestro's picture
Offline
Joined: 06/03/2008
Juice: 31

I cannot find the solution to this anywhere, and I am sure others must have come across the same problem before.

I am setting up a store in Australia. Over here, we charge "Goods and Services Tax" (GST) of 10% on all items - including shipping costs. The regulations for GST are fairly simple:

1) all prices on the store have to be shown already INCLUDING GST
2) all invoices and receipts have to clearly list the GST component of the total paid

I am finding that hard to do with Übercart. It seems to me, that Übercart is intended to be setup so that prices on the store are shown EXCLUDING tax/GST. This is not OK in my situation - in Australia, we *must* advertise prices with the tax included.

However, if I setup my catalog with all product prices already including GST, it seems that Übercart does not give me a way to show on my receipt/invoice the separate GST component of the total price. So, that is not an option.

Ideally, Übercart should be able to determine if a user is in Australia, and display a tax-inclusive price, if needed. Is there a way for Übercart to add the GST to the product price before displaying it? - I searched through product, catalog, order, payment, and workflow-ng configurations and settings, but could not find a way to do it.

I would truly appreciate any guidance from the more experienced users and developers in the forum.

zmove's picture
Offline
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.Internationalizationizer
Joined: 08/13/2007
Juice: 1192
Hi, I posted a module in the

Hi,

I posted a module in the contribution directory that add tax to product price when you display them.

Basically, you create your product managing prices excluding taxes and you select for which roles you have on your website which can see price including taxes and which can see price excluding taxes.

It was wrote on the begining of ubercart, maybe it is outdated now, I don't have time to upgrade my ubercart installation. It works on beta 5 for me, don't know for newer version.

teksestro's picture
Offline
Joined: 06/03/2008
Juice: 31
Re: Hi, I posted a module in the

zmove, thank you very much for your suggestion, and for the work you've done in the "add tax to product price" contribution. Unfortunately, as has been reported in the thread for the contribution, there are several outstanding bugs, which make it quite incompatible with the current version of Übercart - for instance, it does not play nicely with Views, and the current site I am working on makes extensive use of Views everywhere.

Why have you given up on this module? It seems to me that this is something quite *essential* for Ŭbercart, as Australia is not the only country in the world where legislation requires that prices be displayed INC. tax. I can see from early postings in the contribution's thread, that your work was enormously appreciated when you first released it - and I am sure, it would be again, if the contribution were updated! Smiling

Please, keep up the good work!

teksestro's picture
Offline
Joined: 06/03/2008
Juice: 31
Re: Re: Hi, I posted a module in the

I will post here the only solution I've found, which is rather laborious, but which may be of use to others who find themselves in the same situation.

After looking through *many* postings and suggestions, I found that there is a "COMPUTED FIELD" type for CCK. This allows us to create a field which can use php code to automatically compute a value to be displayed in a node. It can use for source any value that your php code can access in Drupal, including other fields in the node.

After downloading, installing and enabling the Computed Field module:

1) go into your Content Types list, and click on "Product", to edit the Product Type, then on "Add Field"
2) add a new field, of type "Computed" - name it anything you wish (I named mine "price_inc_tax"). Click Submit to create the field.
3) You will now be in the field configuration page. In the "Computed Code" field, add:

// ensure the node has an id by saving it if it is new:
if (!$node->nid) node_save($node);

//adding 10% to the price, with rounding:
$node_field[0]['value'] = round($node->sell_price + ($node->sell_price * 0.1), 2);

4) in the "Display Format" field, add:

$display = uc_currency_format($node_field_item['value']);

5) if you want this field to be available to your Views, select "Store using database settings below" - the calculation results have to be stored in the database for Views to be able to see them. I saved it as data type "float", and data length "8,2" (just in case my customer wants to sell things worth hundreds of thousands of dollars...)

That's it, it should work.

The calculation is only performed when you click SUBMIT on a product's Edit page, so in order to see the results in your existing products, you will have to re-submit them, one by one... or perhaps someone has a better suggestion?

Last of all, the new field does not sit nicely with the fields being displayed by Übercart's default product template, so you may have to override the template with your own - instructions for doing that can already be found elsewhere! Smiling

I hope this info will be of use to others.

teksestro's picture
Offline
Joined: 06/03/2008
Juice: 31
Re: Re: Re: Hi, I posted a module in the

It seems I was too quick to think that using a Computed Field would solve this problem...

While the computed field displays the inc. tax price without any problems on the product page, in order for the rest of Übercart to use it, changes would have to be made throughout the entire shop - ie., on the cart display pages and block, product listing pages, etc. Far too many changes.

Perhaps I am approaching this problem from the wrong angle?

It has now occurred to me, that it might be easier indeed to just list the inc. tax price as the product "sell price" - this would make the product pricing correct throughout the entire store, for our purposes in Australia. Then, the only thing missing would be a LINE in the final order, that would list the tax component (= tax total) being paid.

In order to get this functionality, we would need a module *exactly* the same as the current "Tax" core module, with the only difference being, that it would NOT ADD the tax to the final order.

I believe this would provide a solution to all of us in countries where catalog prices have to be inc. tax - ie., Australia, Europe, and many other parts of the world outside the US.

This is probably a trivial solution, which someone with a bit of knowledge of the Übercart framework could implement by making few and minor changes to the existing "Tax" module.

Would anyone be willing to tackle this project? zmove? Eye-wink

Al
Al's picture
Offline
Bug FinderGetting busy with the Ubercode.Internationalizationizer
Joined: 02/14/2008
Juice: 249
Quote: It has now occurred
Quote:

It has now occurred to me, that it might be easier indeed to just list the inc. tax price as the product "sell price" - this would make the product pricing correct throughout the entire store, for our purposes in Australia. Then, the only thing missing would be a LINE in the final order, that would list the tax component (= tax total) being paid.

You also want to sell outside of Australia. Then you have the opposite problem. And I'm not sure what other issues come up if you completely switch off the tax system, probably you move the problem from the store to the order system. Also changes in tax rates will force you to re-enter all prices.

But to assist you: It is possible to add line-items through a module to the checkout. If the line-item's weight is not bigger than zero, it is ignored by the tax system.

teksestro's picture
Offline
Joined: 06/03/2008
Juice: 31
Re: Quote: It has now occurred

Al, thanks for pointing out some possible problems.

The current "Taxes" module *can* be configured (via its connection with workflow-ng) to take into consideration the order's billing or shipping address when applying the tax. It is possible to configure it, for instance, that if the billing address is outside Australia, then no tax is to be applied - so it already caters for the case when a customer wants to sell outside Australia.

I do not want to switch off the tax system. It would be great if it could work just as it does right now, with the sole exception being, that I don't want it to ADD the tax to the order at the end. I still want it to calculate it, and display it to the user during checkout, and on invoices and receipts, but I don't want the tax amount to be ADDED to the order final amount.

Ideally, at this stage, if we could just have a checkbox in the tax rule for a tax, that would let us specify "add this tax to order total" (or not!), then that would solve my immediate problem.

This would not be an ideal solution, however. The main problem I can see at the moment with the way Übercart handles tax is the fact that tax seems to be order-based, rather than product-based. In many countries around the world, different products attract different tax amounts, and these have to be calculated and shown individually to the customer. Even in Australia, where there is only 1 tax (GST) with one simple tax rate (10%), we do have businesses who are partially tax-exempt - like health professionals. In these businesses, people often have to charge GST on some products/services, but not on others. Übercart, at this stage, would not be a good solution for these customers. I suspect that in most of Europe this would be a big problem, too, as generally in most countries there are more than 1 tax rate that can apply to specific products.

It seems to me, however, that this would require a change to a few modules in the core - ie., it would require a change in the way products and orders are handled, and in the entire tax calculation system. I do think that this *is* necessary, for Übercart to fully support countries outside the US, and I hope that there are already plans for such changes to occur in the near future.

For my *immediate* needs, however, the simple change described for the "Taxes" module would already be enough to let me continue! Smiling

zmove's picture
Offline
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.Internationalizationizer
Joined: 08/13/2007
Juice: 1192
Re: Re: Quote: It has now occurred

ATM, the tax management is going to the right way. Adding a tax on the end of the order by calculating line items is the way to go. Why ?

  • Because ou have to manage all your prices excluding taxes, when you calculate your turnover, your commercial margin etc.... all is calculate excluding taxes
  • If you apply some discounts on your order, they have to be applied on product excluding taxes, this is the law in europe (don't know in australia)
  • When you have a tax, you have to show the subtotal excluding tax, then the tax, and then the total including tax. And the current tax module do it very well

So I think showing a tax including price is just a display issue for the product page.

There is only one critical problem with taxes and ubercart ATM, it's the way the subtotal is calculated on the checkout page. It is calculated by adding all product line * product quantity in the cart.

With this way, if you want to show your product prices with taxes on product page, you have to make the reverse calculation on checkout page to return to product prices without tax. If you don't do that, the dirst subtotal will be displayed with tax.

So, the things that ubercart have to do is to calculate the first subtotal line item differently depending on your configuration about tax display on product page if you show prices excluding taxes, make the actual calculation, but if you show prices including prices, the subtotal have to add all product prices includding taxes and then, remove the amount of taxes, this is simple, but it will correct 2 problems :

  • Bring the possibility to show a cart with product including prices on checkout page, which is more user friendly
  • Avoir rounding problems
  • Make ubercart european friendly
frost's picture
Offline
Joined: 07/23/2008
Juice: 134
where to look in the code
teksestro wrote:

It has now occurred to me, that it might be easier indeed to just list the inc. tax price as the product "sell price" - this would make the product pricing correct throughout the entire store, for our purposes in Australia. Then, the only thing missing would be a LINE in the final order, that would list the tax component (= tax total) being paid.

In order to get this functionality, we would need a module *exactly* the same as the current "Tax" core module, with the only difference being, that it would NOT ADD the tax to the final order.

Hi teksestro
I've been digging around in the code, and I think I have found all the places that would need to be changed to make prices tax-inclusive. These are just the functional changes, assuming you wanted to HARD CODE all prices to be tax-included, which is something I'm considering doing for a site I'm working on now. There would be cosmetic changes needed too which I haven't included here: some of the text in the panes and paypal screens would need to change.

Functional areas that would need to be changed:
In uc_taxes.module, the uc_taxes_action_apply_tax() computes the actual tax amount. Since prices are tax-inclusive for you, you'd need to change the code to calculate tax in this way instead:
Tax = Gross - ( Gross / (1+Rate) )

In uc_taxes.js, the getTax() function calls the set_line_item to store the tax details. One of the parameters is 'summed' - if this is set to 0 then the tax amount isn't included in the total.

In uc_taxes.module, the uc_taxes_line_item function would need to add the following at the end of the line item array that is returned:
'calculated' => TRUE,
'display_only' => FALSE,

In uc_taxes.module, the uc_line_item_tax function would need to create the call to set_line_item with 0 (zero) as the second to last parameter (to indicate the tax shouldn't be summed).

frost's picture
Offline
Joined: 07/23/2008
Juice: 134
not a complete list

sorry, i have missed some areas of code. i just tested this and it's all fine until you get to the paypal standard payments screen, where taxes ARE included in the price.

The extra code that needs changed is to remove this line from uc_paypal.module (which is in the payments module):
'tax_cart' => uc_currency_format($tax, FALSE, FALSE, '.'),

Of course this is only for Paypal standard payments. I would guess there could be similar code to be changed for other types of payments.

rsm08's picture
Offline
Joined: 01/28/2009
Juice: 50
Re: not a complete list

I can't believe that you can't choose to have the price displayed including TAX as a standard option. I don't think there are any European countries where you are allowed to list prices excluding tax to consumers.

I've thought about a solution for this problem that I'm going to try. Maybe someone else can use this.

Making a custom module and implementing hook_nodeapi(), I'm going to check for product nodes being inserted or updated. Whenever this happens, the tax will be deducted from the price and the product is saved in the database without tax. When a product node is loaded, I'm going to add the tax to the product for display. So users will only see the price with tax included when browsing the shop, or when editing or adding new products, but in the database products are stored without tax.

This solution should solve most of the problem. The tax module will add tax in checkout, and the invoice will display correctly with the tax amount displayed separately.

The only problem left is the shopping cart, which will display the products without tax. It seems that this can be solved using the cart module's hook_cart_pane(). In my custom module, I will copy the existing cart pane found in the uc_cart module, modify it to display the products correctly, and in the admin interface disable the original cart pane. Now the cart only displays my custom pane with tax added.

I hope someone can use this solution.

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15422
rsm08 wrote:I can't believe
rsm08 wrote:

I can't believe that you can't choose to have the price displayed including TAX as a standard option. I don't think there are any European countries where you are allowed to list prices excluding tax to consumers.

You can contribute to the patch to fix this: http://drupal.org/node/399586

zmove's picture
Offline
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.Internationalizationizer
Joined: 08/13/2007
Juice: 1192
Hi, Thanks for the feedback,

Hi,

Thanks for the feedback, There is a lots of post that expose problems about tax display and I didn't have an exact situation about my module ATM.

I didn't give up this module, but I have some others heavy project to do right now and I don't have time to spend about updating my ubercart install.

I plan to do it, but on a Drupal 6 installation, so I wait a release of ubercart running on it to make a big update of my shop and all related modules.

The Ubercart team plan to make it more European (and in generally taxes) friendly see this post. The idea is to put 2 of my modules : Add taxes to product price and VAT number into the core. But, before that, these 2 modules need a lot of improvements (and probably a complete rewriting) to make them more views friendly, more extensible, more ubercart... ^^

I can't handle the job as Ryan ask to me, cause I have no time ATM (even my free time is busy on website developping ^^) but I can have an adviser role. I already break my head about taxes management for the shop I developped and I already know what you must avoid and what you must do to create a great module.

alexkb's picture
Offline
Joined: 07/28/2010
Juice: 14
Re: Display of Product Price *with* Tax

I know this thread is a little old, but thought I'd mention it anyway - http://drupal.org/project/uc_gst - does exactly what you want. Nice work to Justin Freeman for creating it for the Aussie ubercart users.

Cheers.