Viewing 1 replies (of 1 total)
  • Plugin Author Saravana Kumar K

    (@mycholan)

    Hi, this might help you.

    function wccpf_add_fee( $cart ) {
    
    	$extra_fee = 100;
    	foreach ( $cart->cart_contents as $key => $value ) {
    		/* Check for the value ( or it could be any condition logic ) */
    		if( isset( $value[ "your_wcff_fields_name" ] ) && ( $value[ "your_wcff_fields_name" ] == "your value" ) ) {
    			WC()->cart->add_fee( $value[ "your_wcff_fields_name" ], $extra_fee, true, "" );
    		}
    	}	
    
    }
    add_action( 'woocommerce_cart_calculate_fees', 'wccpf_add_fee', 1 );
Viewing 1 replies (of 1 total)
  • The topic ‘Use custom field to set fee’ is closed to new replies.