-
-
Save tamarazuk/88c6574a110f04db5515 to your computer and use it in GitHub Desktop.
WooCommerce Checkout Add-ons - Enable WPML translation of labels, names, and options
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function sv_wc_checkout_add_ons_wpml_translate( $label ) { | |
return apply_filters( 'translate_string', $label, 'woocommerce-checkout-add-ons', $label ); | |
} | |
add_filter( 'woocommerce_checkout_add_on_get_name', 'sv_wc_checkout_add_ons_wpml_translate' ); | |
add_filter( 'woocommerce_checkout_add_on_get_label', 'sv_wc_checkout_add_ons_wpml_translate' ); | |
function sv_wc_checkout_add_ons_options_wpml_translate( $options ) { | |
$translated_options = array(); | |
foreach ( $options as $option ) { | |
$option['label'] = apply_filters( 'translate_string', $option['label'], 'woocommerce-checkout-add-ons', $option['label'] ); | |
$translated_options[] = $option; | |
} | |
return $translated_options; | |
} | |
add_filter( 'woocommerce_checkout_add_on_get_options', 'sv_wc_checkout_add_ons_options_wpml_translate' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can't get them to register, do I need to change something in the functions file?