Optional service multiplying by tire quantity instead of charging once per vehic

  • Posts: 6
  • Thank you received: 0
  • Hikashop Business
1 week 1 day ago #369987

Hello,

We have a tire shop configured with HikaShop where customers can purchase tires and additional services. Most services are charged per tire unit (mounting, nitrogen inflation, etc.), but we have one specific service that should be charged once per vehicle, regardless of tire quantity: "Steering alignment/geometry for passenger cars".

Current problem: This service is configured as a product characteristic, and when a customer adds 2 tires to cart and selects this optional service, the system multiplies it by 2 (85.95 € × 2 = 171.90 €), when it should only charge 85.95 € once, as this service is performed on the vehicle as a whole, not per individual tire.

What we need:

This service should remain optional (not mandatory)
It should be visible always, even when buying a single tire
When selected, it should add only 1 unit to cart, no matter how many tires are being purchased
All other services should continue working per tire unit as they do now

Question: How should we configure this service to charge it once per vehicle instead of multiplying by tire quantity? Should we use a different configuration method (option instead of characteristic, or separate product)?

Please see attached screenshots:

Product frontend view showing the service
Cart showing the service multiplied by 2
Backend product configuration

Thank you for your assistance.


Pablo Arias

www.pabloarias.eu
Attachments:
Last edit: 1 week 1 day ago by pabloarias. Reason: Small improvement

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

  • Posts: 84956
  • Thank you received: 13846
  • MODERATOR
1 week 1 day ago #369989

Hi,

Yes, you can make an extra fee behave like a fixed charge per order instead of multiplying with quantity in HikaShop by using the Price Calculations plugin together with a custom item field. The idea is that instead of relying on a standard product option (which always multiplies by product quantity), you create a custom field for the extra service and then use the price calculations plugin to inject a flat amount into the price formula based on that field. This lets you apply the extra fee once per order even if the product quantity increases.

The key steps are:

Add a custom item field for the optional service:
www.hikashop.com/support/documentation/4...shop-field-form.html

Use the Price Calculations plugin (which supports formulas using custom field tags) to define a rule that adds a flat fee when that field is selected, without multiplying by quantity:
www.hikashop.com/marketplace/product/148...ce-calculations.html

This gives you much more flexibility than standard options and avoids the quantity multiplication.

The following user(s) said Thank You: pabloarias

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

  • Posts: 6
  • Thank you received: 0
  • Hikashop Business
5 days 18 hours ago #370013

Hello,

I'm using the Price Calculations plugin to add an optional alignment service to tire products. The formula uses a division operation to charge the service once per order (not per tire), but this is causing tax calculation inconsistencies.

We are using Hikashop: 6.1.1

Plugin formula: {price} + ({alignment_service} / {cart_product_quantity})

Custom field configuration:

Table: item
Column: alignment_service
Values: 0, 42.975, 72.00 (without tax)
Tax: 21% Spanish VAT
"Show prices with tax" = Yes

The problem:

With 2 tires + alignment (value 42.975€):

If field value = 42.975€ (without tax):

Product page: 445.40€ (❌ missing ~4.51€ tax on alignment)
Should show: 449.91€
Checkout total: 899.82€ ✓ (correct)
Checkout unit price: 475.67€ (❌ should be 449.91€)

If field value = 52.01€ (with tax):

Product page: 449.91€ ✓ (correct)
Checkout total: 910.74€ (❌ tax applied twice, +10.92€)
Should be: 899.82€

Question:

How should I configure the custom field value (with or without tax) when using division in the formula? The division by quantity seems to cause tax calculation issues.

Expected behavior:

With 2 tires + alignment (one axle) - field value 42.975€ (no tax):
Product page: 449.91€ (with tax)
Calculation: (350.34 + 21.49) × 1.21 = 449.91€
Checkout unit price: 449.91€ (with tax)
Checkout total: 899.82€
Calculation: 449.91 × 2 = 899.82€

Attached files:

plugin.png: Price Calculations plugin configuration
field.png: Custom field "alignment_service" configuration
imagen1.png: Product page, field value 42.975€ (without tax)
imagen2.png: Checkout, field value 42.975€ (without tax)
imagen3.png: Product page, field value 52.01€ (with tax)
imagen4.png: Checkout, field value 52.01€ (with tax)

Could you please advise on the correct configuration for this scenario?

Thank you for your support.


Pablo Arias

www.pabloarias.eu

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

  • Posts: 84956
  • Thank you received: 13846
  • MODERATOR
5 days 6 hours ago #370015

Hi,

Thank you for the detailed report, that really helps understand the issue. However, the screenshots didn't work, somehow.

The problem you're experiencing is due to how tax is being applied when using division in the formula. When you divide by {cart_product_quantity}, the tax calculation becomes inconsistent between the product page display and the checkout total.

Here's what's happening:
When "Show prices with tax" is enabled, the plugin applies tax to your custom field value (alignment_service) before it's used in the formula. But since you're dividing by quantity, the taxed amount gets divided, and then at checkout, the line total is calculated differently, causing the discrepancy.

Suggested workaround:
Try using the alignment value without tax (42.975€) in your custom field, and manually add the tax in the formula:

{price} + ({alignment_service} * 1.21 / {cart_product_quantity})
This way, the tax is applied to the full alignment amount before the division, which should give you consistent results.

Could you please test this and let us know if it resolves the discrepancy? If this works, we can look into adding better support for dynamic tax rates in the plugin, such as a {tax_rate} tag that would automatically use the product's tax rate.

Last edit: 5 days 16 hours ago by nicolas.

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

  • Posts: 6
  • Thank you received: 0
  • Hikashop Business
5 days 3 hours ago #370019

The change you suggested doesn't seem to affect the cart calculations at all. The product page calculations remain correct, but the cart hasn't changed from the previous version. Let me explain the issues I'm detecting in the cart:

The amount of 481,13 € comes from the following operation (all prices with VAT included):

481,13 € - 398,15 € (tire price) = 82,98 €
82,98 € - 47,90 € (mounting × 2) - 3,62 € (eco-tax × 2) = 31,46 €
31,46 € - 26,00 € (alignment / 2) = 5,46 €

These extra 5,46 € come from adding the alignment VAT twice: (52 × 21 / 100) / 2 = 5,46 €

So the alignment VAT is being duplicated.

Additionally, the prices marked with red circles (images in attachments) are very confusing not only for the user but also for us.

I would like to know if the product list in the cart table could be improved so that the unit price shown is for a single tire with its individual options, i.e., tire price + eco-tax + mounting, which in this case would be 423,91 €, and below it a line for alignment (a unit cost since it's per vehicle) of 52 €.

Ideally, the cart should look like this:

"Tire Title" + tire price (398,15 €) ... Unit price 423,91 € ... Qty 2 ... Total 847,82 €

Alignment/wheel geometry: Yes, one axle (+ 52,00 €) ... Unit price 52,00 € ... Qty 1 ... Total 52,00 €

─────────────────────────────────────────────────────────────── 

Total ............................ 899,82 €

VAT .............................. 156,17 €

Amount without VAT ............... 743,65 €

I'm attaching screenshots of the current cart along with screenshots of the plugin configuration and the custom field.

Thank you for your support.


Pablo Arias

www.pabloarias.eu
Attachments:

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

  • Posts: 84956
  • Thank you received: 13846
  • MODERATOR
4 days 22 hours ago #370024

Hi,

Thank you for reporting this issue. We’ve looked into it today. The problem is relative complex and this lead us to add several things to the plugin. We've released just now a fix, among other things, in version 2.2.0 of the Price Calculations plugin.

THE PROBLEM:
When using division in formulas like {price} + ({alignment_service} / {cart_product_quantity}), the cart_product_quantity field was being incorrectly treated as a price and taxed, which broke the calculation.

THE SOLUTION:
The plugin now automatically detects fields that are clearly not prices (quantities, IDs, counts, etc.) and excludes them from taxation. This means your formula will now work correctly.

YOUR FORMULA:
Simply use: {price} + ({alignment_service} / {cart_product_quantity})
Make sure your alignment_service custom field stores the value WITHOUT tax (€42.975 in your case). The plugin will:
1. Tax the alignment_service value (€42.975 -> €52)
2. NOT tax the cart_product_quantity (stays as 2)
3. Calculate: €423.91 + (€52 / 2) = €449.91 per tire
4. Cart total: €449.91 * 2 = €899.82

ADDITIONAL NEW FEATURES:
We also added new modifiers that may be useful:
- :optional:VALUE - Use a default value if a field is missing (e.g., {extra_fee:optional:0})
- :withtax - Force taxation on a field even if it’s auto-detected as non-price

Please update to version 2.2.0, by downloading the latest version of the plugin via the same download link you got after your purchase, and let us know if you have any questions.

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

  • Posts: 6
  • Thank you received: 0
  • Hikashop Business
1 day 23 hours ago #370050

Hello,

I've just tested the new version and I confirm that the VAT issue is completely resolved. The calculations are now correct both on the product page and in the cart.
The prices are calculated perfectly:

Unit price: 449,91 €
Total (2 tires): 899,82 €
The alignment VAT is no longer duplicated

Excellent work, the plugin works exactly as I needed.
Now I would like to ask you about the cart display I mentioned in my previous message. Would it be possible to display the options (Eco-tax, Mounting, Alignment) as independent lines in the cart table instead of as text below the product name?
Can this be configured in Hikashop or would it require modifying the cart template?
Thank you again for your help and for the quick solution.


Pablo Arias

www.pabloarias.eu

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

  • Posts: 84956
  • Thank you received: 13846
  • MODERATOR
1 day 18 hours ago #370055

Hi,

Yes, you can do that with the cart fees plugin:
www.hikashop.com/marketplace/product/279-cart-fee.html
Instead of creating a product and adding that product as an option to the main product to add the extra tax amount, you can create a custom field of the table "product" in order to provide the value you want for it in each product.
Then, in the cart fees plugin settings, you can use a formula to calculate the fee. For example :
{product.xxx}
where xxx is the column name of the cusom product field.

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

Time to create page: 0.052 seconds
Powered by Kunena Forum