How to configure a "free text" Product option?

Hi,

I would like to model a “Voucher” product where the user can buy some specific voucher and where the user is able to enter the price/value of the voucher himself. Currently I just see that I can configure a static list of Product options, for example the user can choose to buy a voucher with the price/value of 100, 200, 300, etc. but the user is not able to buy some voucher with some price defined by himself.

Is such a use case possible to implement out of the box?

If not, how would be the recommended way to implement such a customization?

Thanks for your inputs.

Extend either ProductVariantMatchType and insert custom entry type for your defined option and then using pre submit form event you can dynamically create values from submitted values. You would also need to set newly created value to the form to make it recognizable.

Another option is to make it completely separated and just add custom property to your OrderItem entity and in CartItemType extension define type for it. Then using OrderProcessor you can add price adjustment to the OrderItem. Then you can render it with the same format as regular variant options.

Thanks @vavak for your tipps! I will check it out.

I have also found this plugin here: https://github.com/Brille24/SyliusCustomOptionsPlugin
As I understand the plugin it would solve this use case too.