How can I charge shoppers based on the amount of letters they enter into a Simple Text Box?

I am currently working on a WordPress Powered eCommerce website, where the preferred shopping platform is WooCommerce.

Within the website, there is a Category dedicated to Custom Products. Each of these products can be purchased on their own at their allocated price or, for an additional fee, the shopper can request to have custom text entered onto the product.

So far, I have created a custom field (Simple Text Box) and outputted this onto the Product Page, where shoppers are able to enter any text that they would like to have on the product.

I have then created an additional Custom Field, which is only seen on the Backend (in the Product Data area) of the Product Page. This Custom Field is entitled ‘Cost of Each Custom Letter’ where the cost of each custom letter is entered.

Is anyone aware how I can create a function which counts the amount of letters entered into the Simple Text Box and then multiplies this by the cost of each custom letter, as specified in the Product Page’s back end? Or does anyone have an alternative approach which achieves the same thing?

I would then need the Product’s Price to reflect this calculation as follows:

Product Price + (Cost of Each Custom Letter x Amount of Letters Entered)

Is anyone able to point me in the right direction as to the kind of additional coding I would need to implement, in order to achieve this?

.

Read more here: How can I charge shoppers based on the amount of letters they enter into a Simple Text Box?

Leave a Reply

Your email address will not be published. Required fields are marked *