• Hi, i would like to change the price in the back hand depending and the number of booked room and days (dynamic pricing), which variable in the hook should i change to achieve this purpose ?

    add_action(‘woocommerce_before_calculate_totals’, ‘set_custom_price’);

    function set_custom_price($cart_obj) {
    foreach ($cart_obj->get_cart() as $key => $value) {
    if ($value[‘product_id’] == 3735) {
    $value[‘data’]->set_price(9.90);
    $new_price = $value[‘data’]->get_price();
    }
    }
    }

  • The topic ‘PHP product data’ is closed to new replies.