3

this may be a bit confusing to explain but I'll do my best.

I have products in Store which have a base price and price modifiers which so far works as expected. However I also need to update the price based on user input via a text input field.

Basically the user enters some text, and Javascript counts the characters, which then needs to adjust the price, the original price times the number of characters.

I can't use the item quantity field because of the other price modifiers, these do not change based on the number of letters but are set for each individual product.

I have also been told to use input:custom_modifier_name (https://www.exp-resso.com/docs/store/product_tag.html#inputcustom_modifier_name), and this does seem to work according to the documentation. However it is not obvious to me how this could be used to update the price.

Can anyone help me out? I've went round in a circle a few times.

Thanks, Laura

0

As Store is currently setup text modifiers (created in the CP or via input:custom_modifier_name tag parameters) don't allow for Store to adjust the price of the item. You would want to create a Variation (Single SKU) with the name of text_count or similar with something along the lines of

1 = $1.00
2 = $2.00
3 = $3.00

and so on until you have the max number of characters you want to allow a user to create. Then in your template you could use input:custom_modifier_name to create a text field for every product that would allow the user to enter whatever text that you want to enter in. Then when you calculate the total of number characters in that field you would want to have a bit of Javascript that selects the hidden field text_count and adjust the select field to match the number of characters in your text field.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.