Skip to content Skip to sidebar Skip to footer

How To Use Multiple Filtering Options That Will Affect The Price In Woocommerce Simple Products?

I am using 'Add a select field that will change price in Woocommerce simple products' answer code. It only uses a single selection field for filtering. I want to extend this code u

Solution 1:

Ok i found my answer here now i just need to how to do it in this code?

add_action('woocommerce_before_calculate_totals', 'set_cutom_cart_item_price', 20, 1);

foreach (  $cart->get_cart() as $cart_item ) {
    if ( isset( $cart_item['material_data']['new_price'] ) ){
        $cart_item['data']->set_price( $cart_item['material_data']['new_price'] );
    }
}

Post a Comment for "How To Use Multiple Filtering Options That Will Affect The Price In Woocommerce Simple Products?"