2

I developing a script who increment prices based on specific custom fields.

I finished with products and cart but prices dont change in widget cart.

This is my code (Cart hook):

//INCREMENT PRICE IN CART FOR _NAV_PP FIELDS 
add_action( 'woocommerce_before_calculate_totals', 'nav_pp_cart_price', 10, 1);
add_action( 'woocommerce_before_mini_cart_contents', 'nav_pp_cart_price', 10, 1);

function nav_pp_cart_price( $cart_obj ) {
    //  This is necessary for WC 3.0+
    if ( is_admin() && ! defined( 'DOING_AJAX' ) )
        return;

    foreach ( $cart_obj->get_cart() as $key => $value ) {
        $metas = get_post_meta($value['product_id']);
        $price = $value['data']->get_price();

        $final_price = nav_increment_price($price, $metas);
        $value['data']->set_price($final_price);
    }
}

How can i manipulate the woocommerce widget cart prices?

closed as off-topic by Max Yudin, fuxia May 29 '17 at 20:20

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.

  • 1
    wtf! offtopic? seriously? – 50l3r May 29 '17 at 23:00
  • I need to know who hook use – 50l3r May 29 '17 at 23:00