Support » Plugin: Product Addons & Fields for WooCommerce » Hook in Option Total ppom_price

  • Resolved nativa1

    (@nativa1)


    I neeed hook for

    change Option Total value with select_number

    Ej:
    Select_number
    1
    2
    3

    Option Total = Option Total * select_number;
    20 = 20 * 1
    40 = 20 * 2
    60 = 20 * 3

    How to? What is the variable?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi,

    Sorry, prices are controlled via JS on fron-end and we cannot add hook for this.

    Thread Starter nativa1

    (@nativa1)

    Ok, thank you, i middle solved
    in ppom-price.js

    // Here multiply by select_number
    // line 235 of ppom-price.js
    if ( jQuery(‘#select_number’).length ) {
    option_price_with_qty = option_price_with_qty * jQuery(‘#select_number’).val();
    }

    but not add to cart changes

    • This reply was modified 4 years, 11 months ago by nativa1.
    • This reply was modified 4 years, 11 months ago by nativa1.
    Thread Starter nativa1

    (@nativa1)

    Please, i need send to cart the new total update

    What is the variable?
    Where is the variable?
    Where parsed?

    and I program it

    Well here is filter we have when updating cart line item, it may help you:

    apply_filters('ppom_cart_line_total', $cart_line_total, $cart_items, $values);

    Thread Starter nativa1

    (@nativa1)

    Thank you very much for the clue,
    I full solved !!

    
    // line 460 of woocommerce.php
    $ppom_meta = ppom_make_meta_data( $cart_items, $context="cart" );
    	foreach( $ppom_meta as $key => $meta ) {		
    		//echo $item->get_id();
    		//echo $key." ".$meta['value'];
    		if($key=='select_number'){
    			$total_option_price = $total_option_price * $meta['value'];
    		}
    		//$item->update_meta_data($key, $meta['value']);
    	}
    
    $cart_line_total = ($ppom_item_org_price + $total_option_price + $ppom_quantities_price - $ppom_total_discount);
    	
    $cart_line_total=apply_filters('ppom_cart_line_total', $cart_line_total, $cart_items, $values);

    Cheers.

    If you love our plugin and support please rate us 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Hook in Option Total ppom_price’ is closed to new replies.