Support » Plugin: WooCommerce PayPal Checkout Payment Gateway » Please enable translation for Checkout-Button-Image

  • Resolved cedus

    (@cedus)


    Hey guys,

    please change the line:

    $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 ) );

    to a translateable value for WPML and other plugins.

    It’s in file:
    woocommerce-gateway-paypal-express-checkout/includes/class-wc-gateway-ppec-cart-handler.php

    Thank you,
    Chris

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support Linda

    (@lindamork)

    Automattic Happiness Engineer

    Hi Chris,

    Thanks very much for your feedback! I’ve added your feature request so it can be considered.

    Thank you, Linda.

    Customers should see the button in their respective language to gain their trust.

    EDIT: There is another line with the same code in the same file which has to be edited for translation.

    Plugin Contributor Thomas Shellberg

    (@shellbeezy)

    Automattic Happiness Engineer

    Hey Chris,

    Just to clarify, you wish for the button to be loaded based on the geographic location of the site visitor? In other words, not always use the US-based button URL?

    Hi Thomas,

    sort of, I think it should load based upon the WPML language code if possible.

    Or just give it a string to be manually edited.

    Plugin Support Nicola Mustone

    (@nicolamustone)

    Automattic Happiness Engineer

    Hi,
    you can use the filter woocommerce_paypal_express_checkout_button_img_url to replace the image with one that you can create, in your own language.

    WPML has constants and snippets that you can use to use a different image based on the current language. I’d suggest you reach out to their support or check their documentation to learn how to do this.

    A quick follow up for others, this is how I got it done (in a tiny plugin):

    function paypal_language_filter ($filter){
    	
    	if(defined('ICL_LANGUAGE_CODE')){
    		
    		if(constant('ICL_LANGUAGE_CODE') == 'de'){
    			
    			$filter = plugin_dir_url( __FILE__ ).'images/paypal_express_de.png';
    			
    		}	
    		
    	}
    	
    	return $filter;
    	
    }
    
    add_filter('woocommerce_paypal_express_checkout_button_img_url','paypal_language_filter',100);
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Please enable translation for Checkout-Button-Image’ is closed to new replies.