Update WP woocommerce price only in cart

I am trying to update a price in woo-commerce item that is already in cart.

This is the ajax function that i use to change but i cannot find any kind of option from woo-commerce to set a custom price to an item that is already inside cart and only to that item.

Read More
if ( !empty($_POST['product_id']) ){
        $cart = $woocommerce->instance()->cart;
        $id = $_POST['product_id'];
        $qty = $_POST['qty'];
        $money = $_POST['money'];
        foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $cart_item ) {
            if ($cart_item['product_id'] == $id) {

            }
        }
    }

Here is an example of what i am trying to achieve the second dropdown when selected to update the price accordingly

Example

Related posts

Leave a Reply