【问题标题】:Change size from woocommerce PayPal checkout button in cart从购物车中的 woocommerce PayPal 结帐按钮更改大小
【发布时间】:2020-06-03 06:57:09
【问题描述】:

我使用 WooCommerce PayPal Checkout Gateway 插件。 在 wordpress 的后端,我设置了默认的按钮大小:中。 尝试通过 childtheme css 或插件 wc-gateway-ppec-frontend.css 更改 css 是不可能的。 有人有什么解决办法吗?

【问题讨论】:

    标签: button woocommerce paypal checkout gateway


    【解决方案1】:

    正在从 Paypal 的服务器加载该 PayPal 图像。所以为了改变它,你必须修改插件代码。

    对于结帐页面中的 PayPal 按钮形状,导航至:(第 46 行)

    wp-content/plugins/woocommerce-gateway-paypal-powered-by-braintree/includes/payment-forms/class-wc-braintree-paypal-payment-form.php

    对于购物车页面中的 PayPal 按钮形状,导航至:(第 141 行)

    wp-content/plugins/woocommerce-gateway-paypal-powered-by-braintree/includes/class-wc-braintree-paypal-cart.php

    $default_button_styles = array(
        label: 'checkout',       // pay | paypal | buynow | checkout | credit
        size:  'responsive',     // small | medium | large | responsive
        shape: 'rect',           // pill | rect
        color: 'gold',           // gold | blue | silver | black
        tagline: false,          // true | false   
        fundingicons: true,      // true | false
    );
    

    在您的functions.php 文件中使用以下代码。在您的媒体库中上传自定义 Paypal 徽标,然后在以下函数的 "$express_checkout_img_url" 中替换该 URL。

    // Hook in
    add_filter( ‘woocommerce_paypal_express_checkout_button_img_url’ , ‘custom_override_woocommerce_paypal_express_checkout_button_img_url’ );
    
    // Our hooked in function – $fields is passed via the filter!
    function custom_override_woocommerce_paypal_express_checkout_button_img_url( $variablen ) {
    $express_checkout_img_url = '/wp-content/themes/XXXXXX/images/M3_Logo_01.jpg';
    return $express_checkout_img_url;
    }
    

    查看以下网址了解其他想法: https://docs.woocommerce.com/document/paypal-express-checkout/#section-7

    https://isabelcastillo.com/change-woocommerce-paypal-icon-to-custom-image-with-credit-card-icons

    【讨论】:

    • 谢谢你的tipp,但我没有braintree插件。
    • 我已经用另一个解决方案更新了我的答案。一定要试一试!
    猜你喜欢
    • 2016-03-20
    • 2018-02-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-24
    • 1970-01-01
    相关资源
    最近更新 更多