/**
* @desc Multilingual WooCommerce Pages Routing -
* Option One: Page Routing with default Shop Page slug from Permalinks Shop Base
* @author woomultilingual.com
* @return int $id
*/
// Woocommerce WooCommerce Pages Routing - Option Shop Base Slug
add_filter ( 'woocommerce_get_shop_page_id','woomulti_woocommerce_get_page_id' );
add_filter ( 'woocommerce_get_cart_page_id','woomulti_woocommerce_get_page_id' );
add_filter ( 'woocommerce_get_checkout_page_id','woomulti_woocommerce_get_page_id' );
add_filter ( 'woocommerce_get_terms_page_id','woomulti_woocommerce_get_page_id' );
add_filter ( 'woocommerce_get_myaccount_page_id','woomulti_woocommerce_get_page_id' );
function woomulti_woocommerce_get_page_id( $id ) {
if ( function_exists ( 'pll_get_post' ) ) {
return pll_get_post( $id );
}
return $id;
}
//Cart Page – Return to Shop & Continue Shopping Redirect
function woomulti_woocommerce_return_to_shop_redirect() {
if (function_exists ( 'pll_current_language' ) ) {
$currentlang = pll_current_language();
if ( $currentlang=="de" ) {
return site_url ( '/de/shop/' );
} elseif ( $currentlang=="fr" ){
return site_url ( '/fr/shop/' );
} else {
return get_permalink( woocommerce_get_page_id( 'shop' ) );
}
}
}
add_filter( 'woocommerce_return_to_shop_redirect', 'woomulti_woocommerce_return_to_shop_redirect' );
add_filter( 'woocommerce_continue_shopping_redirect', 'woomulti_woocommerce_return_to_shop_redirect' );
https://wpml.org/documentation/support/language-configuration-files/
woocommerce_flat_rate_settings
var_dump ( get_option('woochimp_options') )
<key name="woochimp_options">
<key name="woochimp_widget_fields">
<key name="1">
<key name="name" />
</key>
<key name="2">
<key name="name" />
</key>
</key>
</key>
/**
* @desc Register WooCommmerce Product Attributes with Polylang
* @author woomultilingual.com
*/
add_action( 'init', 'woomulti_register_product_attributes', 11, 2 );
function woomulti_register_product_attributes() {
// Global variables to interact with both Polylang and WooCommerce
global $polylang, $woocommerce;
// Quit if Polylang or WooCommerce are not activated and ready
if ( !$polylang || !$woocommerce ) {
return false;
}
// Get the product attributes from WooCommerce
$product_attributes = wc_get_attribute_taxonomies();
// In Polylang Settings - String Translation you can group entries
$group = __( 'Product Attributes' );
// Get taxonomies already ready for translation by Polylang
$taxonomies = $polylang->model->get_translated_taxonomies();
// Create array to hold all product attributes as WooCommerce taxonomies
$attributes = array();
foreach ( $product_attributes as $product_attribute ) {
// Each product attribute label will be registered as a string in Polylang
pll_register_string ( $product_attribute->attribute_label, $product_attribute->attribute_label, $group );
//Add each attribute name (not the label) to the taxonomies array and adding "pa_" in front
$attributes[] = substr_replace( $product_attribute->attribute_name, 'pa_', 0, 0);
}
// Merge the product attributes with the existing taxonomies
$taxonomies = array_merge ( $taxonomies, $attributes );
// Adding array to Polylang's filter 'pll_get_taxonomies' so its values are available for translation
add_filter( 'pll_get_taxonomies', function () use ( $taxonomies ) { return $taxonomies; } );
}
add_filter( 'woocommerce_attribute_label', 'woomulti_translate_attribute_label' );
function woomulti_translate_attribute_label ( $label ) {
return pll__( $label );
}