• This is an answer to this thread:
    https://www.ads-software.com/support/topic/qtranslate-comment-code-shows-on-the-paypal-using-woocommerce

    Which was closed for a stupid reason, it was a valid question, and it shows up as the first result on google, and due to it being closed i cannot answer the question in the correct place. (moderators mad with power i say).

    Anyway, here’s the solution:

    function waspdigital_woocommerce_paypal_qtranslate_product_name($paypal_args){
    	// woocommerce uses a function 'paypal_item_name' which shortens these descriptions and seems to crop off part of qtranslates string
    	// an example would be like this:
    	// [item_name_1] => <!--:en-->Software Development, Methodology and Tools<!--:-->
    	// which appears to be missing other languages
    	// this patch just strips out the extra qtranslate stuff so that it doesn't look horrible at paypal checkout.
    	$lang = qtrans_getLanguage();
    	foreach($paypal_args as $key=>$value){
    		if(strpos($key, 'item_name_') !== false){
    			$paypal_args[$key] = str_replace('<!--:en-->', '', str_replace('<!--:'.$lang.'-->', '', str_replace('<!--:-->', '', $paypal_args[$key])));
    		}
    	}
    	return $paypal_args;
    }
    add_filter( 'woocommerce_paypal_args', 'waspdigital_woocommerce_paypal_qtranslate_product_name' );

    https://www.ads-software.com/plugins/qtranslate/

Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Qtranslate Comment code shows on the paypal using woocommerce’ is closed to new replies.