• Resolved wprobbiewp

    (@wprobbiewp)


    I would like to customise the “Check out with PayPal button”.

    The file wp-content/plugins/woocommerce-gateway-paypal-express-checkout/includes/class-wc-gateway-ppec-cart-handler.php contains this line of code:

    $express_checkout_img_url = apply_filters( 'woocommerce_paypal_express_checkout_button_img_url', sprintf( 'https://www.paypalobjects.com/webstatic/en_US/i/buttons/checkout-logo-%s.png', $settings->button_size ) );

    which contains a link to the default button. How do I make it use my own .jpg button in a child theme?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter wprobbiewp

    (@wprobbiewp)

    I tried to edited the hyperlink on lines 130 and 150 to point to my own button then saved the whole file to

    /wp-content/themes/storefront-child/woocommerce-gateway-paypal-express-checkout/includes/class-wc-gateway-ppec-cart-handler.php

    but it still shows the default PayPal button.

    If I make the same changes in wp-content/plugins/woocommerce-gateway-paypal-express-checkout/includes/class-wc-gateway-ppec-cart-handler.php then it shows my button.

    My question is how do I implement this change in a CHILD THEME?

    Plugin Contributor Zandy Ring

    (@zandyring)

    Automattic Happiness Engineer

    Hi there,

    This really isn’t a WooCommerce PayPal question – this would be more appropriate in a theme forum. However, I’ve tried to track down an answer for you! This article (although it is out of date) may give you clues on what to do next:
    https://isabelcastillo.com/change-woocommerce-paypal-icon-to-custom-image-with-credit-card-icons

    And if that doesn’t get you where you need to go, we suggest getting in touch with a developer (we recommend https://www.woocommerce.com/experts/).

    Cheers!

    Tobo

    (@infonetzlichtcom)

    Hello,

    I have the exact same question. is there a possibility to change the button to another than the english one. Actually there is “https://www.paypalobjects.com/webstatic/en_US/i/buttons/checkout-logo-large.png”. There must be other buttons for other languages (de_DE?)… I need a german button by the way ;).

    THANK YOU!!!

    Tobo

    (@infonetzlichtcom)

    I found a solution:
    // 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;
    }

    But I think an option to choose the PayPal Checkout Button should be standard. And it would be more efficient to laod the logo from the own webserver…

    Hi Tobo,

    I have the problem on this site:
    https://www.locomansounds.com/dcc-sound-shopping-cart/

    that when there is something in the basket then the paypal button at the bottom doesn’t show by default it is: https://www.paypalobjects.com/webstatic/en_US/i/buttons/checkout-logo-.png

    I would like to swap it for this image that will show:
    https://www.locomansounds.com/wp-content/uploads/2018/02/gold-rect-paypalcheckout-26px.png

    When I add your code to the functions.php file in the Child theme before the ?> then for the whole site I get this error message:

    This page isn’t working
    https://www.locomansounds.com is currently unable to handle this request.
    HTTP ERROR 500

    the code with my image on is:
    // 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/uploads/2018/02/gold-rect-paypalcheckout-26px.png’;
    return $express_checkout_img_url;
    }

    Thanks for any advice.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to customise “Check out with PayPal button”’ is closed to new replies.