How can i customize the product price by using my own plugin?

I’m trying to create my own plugin and use that plugin to customize product detail page, basically i need to add <input> fields for e.g. „width, depth and height“ and with that way user can customize his own product also when user write some number on that fields the price should change immediately.

I believe variants may help. First you need to define Properties. Let’s say Width. Define Width as a property. Next, define its possible values. This can be hard because Width is not a discrete but a continuous value. So, put the most common ones. Next add all the properties you need. Following create a product variant based on the combination of the properties, lets say a product with width = X and height = Y. Properties can be shown as product filters for user searching. The price change according to existing variants. Hope it helps…

1 „Gefällt mir“

I have tried variants but it couldn’t fixed my problem because in my example i have 3 different variable „width, depth, height“ for each of the variables price should change for each let’s say 5mm in input. So if i use variant for 150mm of width,depth,height i’ll need atleast 30x for each of them instead of this i want to use an input field so the customer can write as much as they wish.

look at this extension, it seems to address your requirements

Product configurator by neonlines GmbH

1 „Gefällt mir“

Thanks but i want to learn how can i solve this problem on my own not using by any plugin and if i should use a plugin i should write it :slight_smile:

hey code.bach!

You basically need a Storefront Javascript Plugin for adhoc calculation of your inputvalues regarding your price.
Best solution for it would be to get the necessary data from the storefont-api and calculate based on the given prices.

Additionally, you should decorate the ProductLineItemFactory so you can provide the given values to the cartprocessors via the lineitem payload.

Next you need to add a CartProcessor, which calculates the price based on your payload.

hope this helps :slight_smile:

regards, martin