Skip Navigation

Resolved

Reported for: WPML Multilingual CMS 3.2.7

Resolved in: WPML 3.3

Overview of the issue

When Visual Composer is active for WooCommerce products, you cannot switch variations tabs in WPML 3.2.7 WCML 3.6.11

Workaround

Solution 1

1. Download this file post-edit_fix_for_WPML_3.2.7.

2. Unzip this download. You will see a file called post-edit.js.

3. Use FTP to connect to your site and override the current file plugins/sitepress-multilingual-cms/res/js/post-edit.js with the unzipped file from step 2.

4. Clear your browser cache.

Solution 2

1. Open file plugins/sitepress-multilingual-cms/res/js/post-edit.js

2. Find (line 240):
/**
* HOTFIX DIALOG BOX
* Remove when WooCommerce does not include jquery-ui smoothness anymore
**/
var jQueryUI = $( '#jquery-ui-style-css[href*="smoothness"]' ),
jQuerySmoothnessHref;

// if jquery ui smoothness css is loaded
if( jQueryUI.length ) {
// event listener for hide
$.each( ['hide'], function ( i, ev ) {
var el = $.fn[ev];
if( $( this.hidden ) ) {
$.fn[ev] = function () {
this.trigger( ev );
return el.apply( this, arguments );
};
}
});

// click on Connect with translations
$( 'body' ).on( 'click', '#icl_document_connect_translations_dropdown .js-set-post-as-source', function() {
var connectDialog = $( '[aria-describedby="connect_translations_dialog"]' );

jQuerySmoothnessHref = jQueryUI.attr( 'href' );
jQueryUI.attr( 'href', '' );

connectDialog.on( 'hide', function() {
if( $( '.ui-widget-overlay' ).length == 0 ) {
jQueryUI.attr( 'href', jQuerySmoothnessHref );
connectDialog.off( 'hide' );
}
} );
} );
}
/* HOTFIX END */

3. Replace with:
/**
* HOTFIX DIALOG BOX
* Remove when WooCommerce does not include jquery-ui smoothness anymore
**/
var jQueryUI = $( '#jquery-ui-style-css[href*="smoothness"]' ),
jQuerySmoothnessHref;

// if jquery ui smoothness css is loaded
if( jQueryUI.length ) {
// click on Connect with translations
$( 'body' ).on( 'click', '#icl_document_connect_translations_dropdown .js-set-post-as-source', function() {
var connectDialog = $( '[aria-describedby="connect_translations_dialog"]'), intervalCheckDialog;

// abort if dialog does not exists
if( ! connectDialog.length ) return false;

// backup href of jquery ui smoothness
jQuerySmoothnessHref = jQueryUI.attr( 'href' );

// remove jquery ui smoothness css
jQueryUI.attr( 'href', '' );

// check every 250ms if connect translations dialog is still open
intervalCheckDialog = setInterval( function() {
// if dialog is not open anymore
if( ! connectDialog.is(':visible') ) {
if( $( '.ui-widget-overlay' ).length == 0 ) {
// reapply jquery ui smoothness css again
jQueryUI.attr( 'href', jQuerySmoothnessHref );
// stop interval
clearInterval( intervalCheckDialog );
}
}
}, 250 );
} );
}
/* HOTFIX END */

4. Save and close.

5 Responses to “Variations tab not effective when Visual Composer used with WC products”

  1. Hi WPML,
    I checked this code with V.C. But, the issue is not solved on VC.4.8.0.
    This code work for V.C. 4.7.4, not 4.8.0.

    So any idea ?

    • Hi,

      We have tested with our latest WPML release candidate, which you can grab here – https://wpml.org/account/downloads/ (right at the bottom – CMS Beta Package). Please remember this is a beta version so not recommended for production sites – you can test on a safe environment.

      Please let me know if it worked.

      Thanks!