hi @jmoutsounis,
We currently do not have that feature, for the free products are you perhaps using a 3rd party plugin to give the free products? If yes, please reach out to their support team.
If you are say creating a product and setting the price to 0 then. You can add the snippet to your child theme’s functions.php or through the WPCode plugin
The snippet will stop the invoice payment gateway if the customer’s cart only haves free product(0 in price) in their cart. If there’s shipping fees, invoice will still be hidden as there is not product of value
add_action('woocommerce_available_payment_gateways','Stop_Payment_Gateway',9999);
function Stop_Payment_Gateway($available_gateways){
if(is_cart() || is_checkout()){
$total= WC()->cart->get_subtotal();
if($total > 0 ){
//return nothing
}else{
unset($available_gateways['igfw_invoice_gateway']); // Add the payment Code ID here
}
}
return $available_gateways;
}