NNKK
NNKK

Reputation: 257

How to add calculated text fields in woocommerce add product page?

I am working woocommerce v2.2.11. I like to add extra text fields under the Regular Price & Sale Price fields in Add New Product Page. The newly added fields contains custom values like 5% or 2% etc... When admin enters the product regular price, the price should be calculated with newly added text fields value.

For Example... Regular Price(Rs) : 100 Text Field 1 : 5% (5% of 100 is 5) Text Field 2 : 2% (2% of 100 is 2) Text Field 3 : 107 (Regular Price + Text Field 1 + Text Field 2)

Note: Text Field 3 should automatically calculated when admin enters Regular Price Value.

How to achieve this....?

Upvotes: 0

Views: 1419

Answers (1)

Domain
Domain

Reputation: 11808

First of all, you should ask this question at WordPress Stackexchange to get proper answer.

I have some idea for you -

1) You can follow this article to add new fields you want on edit product page - http://www.remicorson.com/mastering-woocommerce-products-custom-fields/

2) On keyup event, write jQuery code to perform calculations for the newly added fields.

Upvotes: 0

Related Questions