Issue

Situation: there are several payment methods on the WordPress website in the Woocommerce module, but not all of them display the corresponding logos on the checkout page.

Solution

Add this code to the end of the functions.php file in your child theme:

// Add PAYMENT_GATEWAY logo at checkout page
function PAYMENT_GATEWAY_checkout_icon() {
    // pls return the new logo/image URL here
    return 'PAYMENT_GATEWAY_URL'; 
}
add_filter( 'woocommerce_PAYMENT_GATEWAY_icon', 'PAYMENT_GATEWAY_checkout_icon' );

Where…
PAYMENT_OPTION – the payment method for which you want to add/change the logo.
PAYMENT_OPTION_URL – full internet address of the logo location.

In this case, the options for PAYMENT_GATEWAY are known in advance:
bacs – Direct Bank Transfer
cheque – Cheque Payment
cod – Cash on Delivery
paypal – PayPal payment
cp – Cash on Pickup (previously installed plugin Payment Cash Pickup)

In other words, the code might look like this:

// Add Bacs Privatbank logo at checkout page
function bacs_checkout_icon() {
    // pls return the new logo/image URL here
    return '/wp-content/uploads/Privatbank.png'; 
}
add_filter( 'woocommerce_bacs_icon', 'bacs_checkout_icon' );

// Add Cash on pickup logo at checkout page
function cp_checkout_icon() {
    // pls return the new logo/image URL here
    return '/wp-content/uploads/cash-on-pickup-2.png'; 
}
add_filter( 'woocommerce_cp_icon', 'cp_checkout_icon' );

Leave a comment

Your email address will not be published. Required fields are marked *