mercredi 22 mars 2017

if condition in variable in a PHP, for translation purpose

I need to add a translation for $price_html. I am not sure how to do it. Here is my original code:

add_filter('woocommerce_get_price_html', function($price_html, $product) { if(!$product->is_purchasable() && is_product()) {
$price_html .= '<p style="color:#ff0000;">' . __('This product cannot be purchased together with another one. If you wish to buy this product, please remove the other products from <a href="http://ift.tt/2o3SUuY">your cart here</a>.', 'woocommerce') . '</p>'; } return $price_html;}, 10, 2); 

And here is my code to include for the translation:

<?php if(ICL_LANGUAGE_CODE=='en'): ?> This product cannot be purchased together with another one. If you wish to buy this product, please remove the other products from your cart here <?php elseif(ICL_LANGUAGE_CODE=='fr'): ?> Ce produit ne peut être acheté avec un autre produit. Si vous souhaitez acheter ce produit, vous devez supprimer les autres produits de votre panier ici.</a> <?php endif; ?>

Thank you very much for your help! I am stuck.

Aucun commentaire:

Enregistrer un commentaire