order discount tax

  • Posts: 5
  • Thank you received: 1
3 weeks 1 day ago #369165

-- HikaShop version -- : HikaShop Starter: 6.1.0
-- Joomla version -- : 5.4.0
-- PHP version -- : 8.3
-- Browser(s) name and version -- : chrome
-- Error-message(debug-mod must be tuned on) -- : "order_discount_tax": "0.00000",

Regardless of the VAT rate set for the coupon, I always see 0.00000 in the logs.
"order_discount_tax": "0.00000",

Please Log in or Create an account to join the conversation.

  • Posts: 84713
  • Thank you received: 13780
  • MODERATOR
3 weeks 13 hours ago #369166

Hi,

What logs are you referring to ? Do you see the correct value in the order_discount_tax column of the hikashop_order table in your database ?

Please Log in or Create an account to join the conversation.

  • Posts: 5
  • Thank you received: 1
3 weeks 13 hours ago #369172

I'm creating an integration with an external service and saving all order data to a file to check the values. The default tax category is 23. I'm adding a coupon with a fixed value of 10 and setting the Automatic Taxes to NO and the Tax Category to Default Tax Category. In the order data, my coupon has a value of 10, but the VAT rate is 0. The order_discount_tax in the Hikashop table is also 0.

Last edit: 3 weeks 12 hours ago by nicolas.

Please Log in or Create an account to join the conversation.

  • Posts: 84713
  • Thank you received: 13780
  • MODERATOR
3 weeks 10 hours ago #369173

Hi,

Well, if the VAT rate is 0 in the cart, it's normal that the order_discount_tax value is also 0 when the order is created from the cart.
And thus, the problem has nothing to do with HikaShop not properly filling the order_discount_tax value when the order is created from the cart. The problem is that the tax is not calculated for the coupon.
And based on what you wrote, the issue is likely that your taxes are not configured properly for what you want to do.

I've checked your settings with the backend access you provided. I think the issue is with the "apply coupon" setting of the HikaShop configuration:
www.hikashop.com/support/documentation/5...nfig.html#main_taxes
Since that setting is set to "after taxes", it means that the taxes are calculated for the cart, and then the coupon applies to the cart.
You probably want to change that setting to "before taxes". And you also want to change the flat amount of your coupon as you want to provide the value without taxes: 8.13
I've made the changes for you and now the taxes properly updates based on the value of the coupon when added to the cart:
i.imgur.com/a3YiI0R.png

Please Log in or Create an account to join the conversation.

  • Posts: 5
  • Thank you received: 1
2 weeks 6 days ago #369189

Okay, that works, but I don't have a tax rate for the coupon. There's only a tax amount.

Please Log in or Create an account to join the conversation.

  • Posts: 84713
  • Thank you received: 13780
  • MODERATOR
2 weeks 6 days ago #369191

Hi,

Yes. That's the same for the other things. If you check the order_shipping_tax or the order_product_tax columns in the database or the corresponding attributes in the $order object, it's only the tax amount that is provided.
The details of what tax rate is applied, with which untaxed amount as base, etc is all stored in the order_tax_info for the whole order and the order_product_tax_info columns for each product.
The data in there in the database is serialized with PHP's serialize function:
www.php.net/manual/en/function.serialize.php
In plugins, you should have the data readily available in $order->order_tax_info as an array of objects with the keys of the array being the tax rate namekey provided when creating the tax rate via the "manage rates" button of the System>Taxes menu.

Please Log in or Create an account to join the conversation.

Time to create page: 0.071 seconds
Powered by Kunena Forum