1

I'm using the skrill plugin for electronic payments. the plugin plugin, however, does not give me the possibility to add a description to the payment method, how can I do it using the function file? I tried to use the code on this page:

Additional field on checkout for specific payment gateway in Woocommerce

but it does not work, how can I do?

LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399
Federica
  • 11
  • 3

1 Answers1

1

The hook woocommerce_gateway_description can't work for SKRILL payment options as WC_Payment_Gateway get_description() is not defined in SKRILL plugin code.

So you shuld need to tweak it differently to have a description for SKRILL payment options in Woocommerce checkout page, this way:

add_filter( 'woocommerce_gateway_icon', 'gateway_skrill_description', 10, 2 );
function gateway_skrill_description( $icon, $payment_id ){
    if ( \strpos($payment_id, 'skrill') !== false ) {
        $description_text = __("You can pay with your credit card if you don’t have a SKRILL account...", "woocommerce");
        $icon .= '</label><div class="payment_box payment_method_'.$payment_id.'" style="display:none;"><p>'.$description_text.'</p></div>';
    }
    return $icon;
}

Code goes in function.php file of your active child theme (or active theme). tested and works.

enter image description here

LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399
  • 1
    done, I'm sorry I joined recently, I do not know well the operation of the platform, however you're a big :) – Federica Jan 29 '19 at 09:39