Product option that adds 10% to the product price

  • Posts: 36
  • Thank you received: 2
  • Hikashop Business
1 month 1 week ago #365847

-- HikaShop version -- : 5.1.4
-- Joomla version -- : 5.2.4
-- PHP version -- : 8.2.27

Hi,

I need to have options in products that calculate the product price with a percentage.
There may be 2 or 3 to choose from and each of them should calculate a % on the original product price.
So let's say I have a product with a price of €100,-.
If I choose option 1, it will add 10% to the base price.
I I also choose option 2, it will add another 8% to the base price.

Can this be done with the 'Calculate price' plugin? Or can this be done with the 'cart fee' plugin? Or is there another way? What would you recommend?

Thanks a lot!

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

  • Posts: 83512
  • Thank you received: 13511
  • MODERATOR
1 month 1 week ago #365850

Hi,

It can be done with the price calculations plugin and custom fields of the table "item" for the options:
www.hikashop.com/marketplace/product/148...ce-calculations.html
www.hikashop.com/support/documentation/4...shop-field-form.html

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

  • Posts: 36
  • Thank you received: 2
  • Hikashop Business
2 weeks 4 hours ago #366252

Thanks.

We've bought the plugin. I have created a custom field for products where I can put the percentage that has to be added to the price for this option. But what do I need to enter in the plugin settings?

In the screenshots you can see the custom field that I made.
And the percentage I added in the product options (it is a variant of a product, actually, because this option is just a lot of colors, some colors may add 10% to the price, some other options don't add to the price).
And a screenshot of the setting in the plugin, but it doesn't do the trick ;-)

Can you help me out please?

Attachments:

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

  • Posts: 83512
  • Thank you received: 13511
  • MODERATOR
2 weeks 1 hour ago #366253

Hi,

You need to create a custom field of the table "item", not "product".
And you want to make it a dropdown, or radios, or checkboxes, not a text field. You don't want to let the customer enter the percentage.
You want to have him select among a list of choices. And in the "data" area of the field, you can enter the values to be selected. In the "value" column, you can enter the percentage to be used, and in the "title" column, you can enter the text the customer will see.
Then, in the formula of the plugin you can use a formula like what you already did.

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

  • Posts: 36
  • Thank you received: 2
  • Hikashop Business
1 week 6 days ago #366279

Hi Nicolas,

When I create a custom field of the type 'Item' I can't find it in the product in the backend. Where should it be? If I make a custom field of the type 'product' I can find that field in the product and enter a number (like 1.1 if I want to add 10% to the price when this option is selected).

Maybe I'm not clear on what I want to accomplish:

! have a product X. That product has an option, Y. The option has multiple variants, let's say Y-1, Y-2, Y-3 etc. The option does not have a price of itself, it just adds 10% to the price of product X. Some variants will add 10%, some options will add 8% and some options will add nothing.

Hope this is clear ;-)

Thanks in advance for your help.

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

  • Posts: 83512
  • Thank you received: 13511
  • MODERATOR
1 week 5 days ago #366280

Hi,

It's normal you don't see it in the backend. It's an option for the customer to select Y-1 or Y-2 or Y-3. So you want to use the table "item" so that the field appears on the frontend, for the customer, and you can define Y-1, Y-2 and Y-3 in the "data" area of the custom field.
Here is an example:
i.imgur.com/JPT6aJa.png
And you can use the formula:
{price}*{option_y}
Then, if the customer selects Y-0 in the custom field, the price will be base price * 1 => base price
If the customer selects Y-1 in the custom field, the price will be base price * 1.1 => base price + 10% of base price
If the customer selects Y-2 in the custom field, the price will be base price * 1.08 => base price + 8% of base price
If the customer selects Y-3 in the custom field, the price will be base price * 1.05 => base price + 5% of base price

Are we clear that it is what you want ?

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

  • Posts: 36
  • Thank you received: 2
  • Hikashop Business
1 week 3 days ago #366318

Ah, I see. This is different from what I had in mind ;-) I had created a product with variants, and use that product as an option of the main product. The variants should add a percentage.

I tried your way, I can see that should also do the trick but there's 1 problem: I can't add more options with the same value, it will only save 1 field with value 1.1 and 1 field with value 1. I have a list of 56 colors to choose from, some will add 10% and some will add nothing.

Is there a way to calculate the price using the product with variants, as I was trying to do?

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

  • Posts: 83512
  • Thank you received: 13511
  • MODERATOR
1 week 2 days ago #366319

Indeed, you can't have several values with the same "value" in the data of a custom field.
Now, there is a way to go around this.
Suppose that you need to have three values with 10% price increase. Since the custom field "values" are saved as strings the value "1.1" and the value "1.10" are not the same for it. But when the plugin will process the formula, it will result in the same percentage increase. So, you could use the value 1.1 for one, 1.10 for another and 1.100 for another. There is no limit to the number of zeros to add so, like this, you could have dozens of rows for the same price increase and it would work fine.

Regarding variants:
If you create a product X with a characteristic and you configure variants for it, you can edit each variant and use the "Main product price percentage" setting to set, for example, 110 %. If you have a price of 10€ in the main product X, the variant will automatically have a price of 11€ calculated on the fly on the frontend.
However, if you use that product X as an option of another product Y, it will still be the price of product X which will be taken into account, not the price of product Y.
It seems to me that it is what you were trying to do. But this won't work. Thus, I recommended using a custom item field with the price calculations plugin as it can do what you want.

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

  • Posts: 36
  • Thank you received: 2
  • Hikashop Business
1 week 3 hours ago #366336

Ah, I see. Yeah, at first I wanted to create variants for all colors, but, as the main product also has variants for length and height, some products already exist of 800 variants. It's impossible to add 3 color-choices that all three exist of 56 colors (I tried, the whole site crashed at is resulted in more than 2,5 mln. variants :side: ).
Well, I'll go with your method of adding extra zero's, let's see if it will work. It'll be a lot of zero's.

The following user(s) said Thank You: nicolas

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

Time to create page: 0.073 seconds
Powered by Kunena Forum