Viewing 1 replies (of 1 total)
  • Thread Starter Paulo Iankoski

    (@pauloiankoski)

    I solved this way:

    add_action( 'woocommerce_add_cart_item', 'remove_duplicated_item' );
    function remove_duplicated_item($var) {
    	global $woocommerce;
    
    	foreach( $woocommerce->cart->cart_contents as $key => $value ) {
    		if( $value['product_id'] == $var['product_id'] ) {
    			unset($woocommerce->cart->cart_contents[$key]);
    			return $var;
    			break;
    		}
    	}
    	return $var;
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Variable Product’ is closed to new replies.