# Calculate price and display on woocommerce product single page under price (simple price, variable price) [closed]

I am planing to show a new price on my woo-commerce product page for all products. This is the installment price per month. I need to show this below the normal price (variable price and simple price) something like this.

0% interest installments starting from Rs.3,093

where Rs.3,093 is the new price.

this is the calculation i tried on W3 schools, and i got the calculation correct.

whereas 60000 is the price of the product multiplied by this number 5.15464 divided by 100

answer is 3,093 (answer should be rounded off to the nearest integer)

I need a custom function for this where i can add to my functions.php

``````<script>var x = myFunction(60000, 5.15464, 100); function myFunction(a, b, c) { return Math.round (a * b / c);}</script>
``````

## closed as off-topic by Nathan Johnson, Michael, Jacob Peattie, fuxia♦Aug 15 at 20:46

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

One way to add JavsScript in functions.phhp is to put the JavaScript into a JS file an enqueue it. With `wp_enqueue_script()`.

js/mynicecode.js

``````var x = myFunction(60000, 5.15464, 100); function myFunction(a, b, c) { return Math.round (a * b / c);
``````

in functions.php

``````function my_load_scripts(\$hook) {
wp_enqueue_script( 'mynicecode_js', plugins_url( 'js/mynicecode.js', __FILE__ ), array());
} 