Are you looking for a way to hide the payment icons when the cart total in free? This might be a good idea as to not confuse people with the payment button when cart total is free. While there’s probably a plugin for this, we have created a quick code snippet that you can use to hide payment icons when cart total is free.
Note: The code will work for the Easy Digital Downloads payment section only.
Instructions:
All you have to do is add this code to your theme’s functions.php file or in a site-specific plugin:
function sumobi_edd_hide_payment_icons() { $cart_total = edd_get_cart_total(); if ( $cart_total ) return; remove_action( 'edd_payment_mode_top', 'edd_show_payment_icons' ); remove_action( 'edd_checkout_form_top', 'edd_show_payment_icons' ); } add_action( 'template_redirect', 'sumobi_edd_hide_payment_icons' );
Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly add code snippets in WordPress, so you don’t accidentally break your site.
If you liked this code snippet, please consider checking out our other articles on the site like: 28 best WordPress resume themes and how to create WordPress optin forms.
Comments Leave a Reply