dongqie4402 2019-01-28 12:02
浏览 140
已采纳

使用Skrill插件将WC_Payment_Gateway描述添加到Woocommerce选项付款中

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?

  • 写回答

1条回答 默认 最新

  • douling8772 2019-01-28 18:39
    关注

    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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 ensp的问题(需要各个路由器命令)
  • ¥15 Matlab怎么求解含参的二重积分?
  • ¥15 苹果手机突然连不上wifi了?
  • ¥15 cgictest.cgi文件无法访问
  • ¥20 删除和修改功能无法调用
  • ¥15 kafka topic 所有分副本数修改
  • ¥15 小程序中fit格式等运动数据文件怎样实现可视化?(包含心率信息))
  • ¥15 如何利用mmdetection3d中的get_flops.py文件计算fcos3d方法的flops?
  • ¥40 串口调试助手打开串口后,keil5的代码就停止了
  • ¥15 电脑最近经常蓝屏,求大家看看哪的问题