WPML

Aperçu de l’anomalie

Lorsque vous utilisez Deposits & Partial Payments for WooCommerce avec WPML, vous pouvez rencontrer les problèmes suivants : un produit traduit ne reprend pas les paramètres d’acompte propres au produit, et l’e-mail de « paiement d’acompte reçu » parvient au client dans la langue par défaut.

Solution de contournement

Allez dans WPMLParamètres et ajoutez ce qui suit à la Configuration XML personnalisée :

<custom-fields>
    <custom-field action="copy">_awcdp_deposit_enabled</custom-field>
    <custom-field action="copy">_awcdp_deposit_type</custom-field>
    <custom-field action="copy">_awcdp_deposits_deposit_amount</custom-field>
</custom-fields>
<admin-texts>
    <key name="woocommerce_awcdp_deposit_paid_settings">
        <key name="subject" />
        <key name="heading" />
        <key name="email_text" />
        <key name="payment_text" />
    </key>
</admin-texts>

Ensuite, traduisez les textes des e-mails dans WPMLTraduction de chaînes, et ajoutez le code suivant au fichier functions.php de votre thème enfant, afin que le texte de l’e-mail et le texte de paiement utilisent la langue de la commande :

PHP
add_filter( 'woocommerce_email_get_option', function ( $value, $email, $old, $key ) {
	if ( 'awcdp_deposit_paid' !== $email->id || ! in_array( $key, [ 'email_text', 'payment_text' ], true ) ) {
		return $value;
	}
	if ( empty( $email->object ) || ! is_a( $email->object, 'WC_Order' ) ) {
		return $value;
	}
	$lang = $email->object->get_meta( 'wpml_language', true );
	if ( ! $lang ) {
		return $value;
	}
	return apply_filters(
		'wpml_translate_single_string',
		$value,
		'admin_texts_woocommerce_awcdp_deposit_paid_settings',
		'[woocommerce_awcdp_deposit_paid_settings]' . $key,
		$lang
	);
}, 20, 4 );

Toutes les anomalies connues

Besoin d'aide pour ce problème ?

Faites une demande d’assistance et nous l’examinerons avec vous.