jQuery show the total of (ACF custom number field * quantity) in singel product page

Hello programmers
please help me I am a beginner with wordpress and really have a llot of time trying to fix this ..

I am useing
WordPress 4.9.8
Woocommerce 3.4.5
divi premium theme
ACF plugin pro 5 latest update
and every thing well updated ..

I have a new shop project
i have purchased the ACF 5 plugin pro i make acf number field as a Product points value custom field , its the number of product value points (pv) that my project need to be showin with the total summary ..
means :-
product quantity * product price = total price
product quantity * pv = total product pv

i want to show product acf number field (pv) times selected quantity on woocommecre product page like this:-


This is my acf number field :

showing the custom field workout with me :

add_action( ‘woocommerce_single_product_summary’, ‘my_pv_value’, 25,2 );

function my_pv_value() {
echo ‘<b>PV:</b> ‘ . get_field(‘pv’);
// Note: ‘PV’ is the slug of the ACF

and this is the local generated php for the acf number field (pv) file from acf pro tools :

// pv field php generated file :
if( function_exists(‘acf_add_local_field_group’) ):

‘key’ => ‘group_5b9a18dd07cd3’,
‘title’ => ‘pv’,
‘fields’ => array(
‘key’ => ‘field_5b9a2d23996d4’,
‘label’ => ‘pv’,
‘name’ => ‘pv’,
‘type’ => ‘number’,
‘instructions’ => ‘pv value’,
‘required’ => 1,
‘conditional_logic’ => 0,
‘wrapper’ => array(
‘width’ => ”,
‘class’ => ‘pv’,
‘id’ => ”,
‘default_value’ => ”,
‘placeholder’ => ”,
‘prepend’ => ”,
‘append’ => ”,
‘min’ => 0,
‘max’ => 100,
‘step’ => 1,
‘location’ => array(
‘param’ => ‘post_type’,
‘operator’ => ‘==’,
‘value’ => ‘product’,
‘menu_order’ => 0,
‘position’ => ‘normal’,
‘style’ => ‘default’,
‘label_placement’ => ‘top’,
‘instruction_placement’ => ‘label’,
‘hide_on_screen’ => ”,
‘active’ => 1,
‘description’ => ‘pv value’,


how to modify this code snippt to do the same jop as price * qty in woocommerce_single_product_summary ?

// dynamic changer for total value this is a demo for the code final jquery http://reigelgallarde.me/programming/show-product-price-times-selected-quantity-on-woocommecre-product-page/

add_action( ‘woocommerce_single_product_summary’, ‘woocommerce_total_product_price’, 31 );
function woocommerce_total_product_price() {
global $woocommerce, $product;
// let’s setup our divs
echo sprintf(‘<div id=”product_total_price” style=”margin-bottom:20px;”>%s %s</div>’,__(‘Product Total:’,’woocommerce’),'<span class=”price”>’.$product->get_price().'</span>’);
var price = <?php echo $product->get_price(); ?>,
currency = ‘<?php echo get_woocommerce_currency_symbol(); ?>’;

if (!(this.value < 1)) {

var product_total = parseFloat(price * this.value);

$(‘#product_total_price .price’).html( currency + product_total.toFixed(2));


i am really confused and tired after two weeks of heavy docmentaion reading for acf pro and wp and woocommerce and allot of plugings and blogs and snippets and tutorials … etc

please help me >>>>

and i will be really happy if i manged how to but the generated pv total results in cart page as pv total but not related to total money because total its only calculate of product points value not the price*qty

and how to but it in checkout page too.

i am really in need for this fix so i can move to my project other things

i am really appreciate your help.

Read more here:: jQuery show the total of (ACF custom number field * quantity) in singel product page

Leave a Reply

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