This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 17 replies, has 2 voices.

Last updated by laurenceC-6 7 months, 3 weeks ago.

Assigned support staff: Yvette.

Author Posts
January 22, 2019 at 11:56 am

laurenceC-6

Recently colour swatches stopped saving in WooCommerce on non-default language sites only.

I have determined it is WPML String Translation and WPML Translation Management causing it. If I disable one of these only, it saves OK. If both are enabled it wont save.

So the main english site is OK.

We then go to one of our other language sites, or a new language site, and enter its option names in the other language, and we notice the colour of swatched is #ffffff (and not copied the default colours), so we go to set these to the correct colour, and click Update, but they do not save, the colour stays at #ffffff.

The colour is sent in the POST vars, as follows:
_swatch_type_options[296cc9a02b167493f6ff885c48ca71ff][attributes][bf1be2fb5772cb02828337768c83a4be][color]: #505457

So looks like its not saving.

We have tested this on this site hidden link which ONLY has the following plugins enabled:
WooCommerce, WooCommerce Multilingual, WPML String Translation, WooCommerce Variation Swatches and Photos, WPML Multilingual CMS
And it only has TwentyNineteen enabled.

When we disable WPML String Translation OR disable WPML Translation Management from the above, it saves OK.

When we revert back to our main site and theme, with all our plugins, and then disable WPML String Translation OR WPML Translation Management, it also saves OK. So there is no other conflict.

We have increases PHP max_input_vars to 15000 and still get the issue.

We contacted Lucas Stark of WooCommerce who developed WooCommerce Variation Swatches and Photos, but he said its to do with WPML and to contact you.

So please can you look into this with a matter of urgency as we cannot sell product variations on our international websites.

January 22, 2019 at 2:37 pm #3116972

Yvette
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

Hello

I´ll be helping you with this.

Could you please give me a concrete user-case example that illustrates this problem? e.g. product name or steps on how to see the problem you are describing.

If you can upload any screenshots that you think will make your explanation clear - that would be be great.
I have access to your site but I´m not sure where to start navigating to.

Thanks

January 22, 2019 at 3:35 pm #3117249

Yvette
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

Hello

While I was waiting for your response I did some research and found an open internal compatibility work ticket regarding this plugin. For the moment, it looks like there are known issues with this plugin espeically for custom attributes (like the ones you are using). It seems to be working as expected for global attributes.

I would appreciate if you could do the following:

1. Create a new product with a new custom swatch (call it something other than Colour)
2. After publishing the product, please create a WPML Duplicate to the FR language
3. Then open the FR product and "Edit independently". Make your changes to the swatch options that you need.
4. Did the swatch options transfer over? And are you able to save any changes you make?

Thanks for advising.

January 23, 2019 at 4:05 pm #3121506

laurenceC-6

Hello we have staging site and live site, I tried creating a new product in both and a brand new product the swatches worked, but existing products still react the same, you change the colour and it doesn't save

January 23, 2019 at 6:14 pm #3122004

Yvette
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

Ok - I was hoping that a note I had seen written might work for you but I see that it did not.

Then I´m afrad that we have to wait until the compatibility team sorts out the problem with the plugin author.

I´ve added this ticket to the list of clients waiting on a solution. I will be able to update you when I get news from the compatibility team.

For now, setting the status to "Escalated to 2nd tier".

January 25, 2019 at 3:10 pm #3129526

laurenceC-6

Hello is there any news on this?

January 25, 2019 at 4:06 pm #3129796

Yvette
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

Sorry - nothing to report. I´ve left a note on the work ticket that you enquired today about the status.

If I hear anything back form them, I will update this ticket.

January 29, 2019 at 11:47 am #3139508

laurenceC-6

My Client Ickle Bubba has now been waiting 4 days with no response other than its escalated tier 2 issue which has not been resolved, please can you give me an email address or contact details for someone that can let me know when this issue will be addressed and fixed phil@amityweb.co.uk is my email I request a contact email of the date when this will be fixed or at least looked into? Your chat system never seems to be available I would really like to fix this asap but your support system is not good enough.

January 29, 2019 at 12:53 pm #3139789

Yvette
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

I can add another note in the work ticket but I have to let you know that compatibility issues can take a long time to fix and depend on a lot of factors including:
- avialability and willingness of the plugin authors to work with our team
- priority of the work as balanced against other open issues
- number of clients waiting for a fix

I also take this opportunity to remind you of our support policy (see image) and you can read it here:
https://wpml.org/purchase/support-policy/

If you are not satisfied with this response, let me know and I will try to get a manager to contact you. As a first contact supporter, the most I can do is tell you the status of the ticket and remind you of our support policy.

February 4, 2019 at 11:51 am #3157354

laurenceC-6

It has been over 10 days awaiting a response to how this issue can be fixed?

February 5, 2019 at 11:24 am #3161499

Yvette
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

Hello

I see an update on the work ticket that the problem is due to an issue with the WPML Media Translation that needs to be fixed first.

So, the status is still pending on your particular comaptiblity ticket.

I remind you that that these tickets can take a long time to resolve. Sorry to not be able to tell you anything more.

February 12, 2019 at 1:14 pm #3188650

laurenceC-6

hello Is there any news on swatch updates?

February 14, 2019 at 12:14 pm #3199488

Yvette
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Madrid (GMT+02:00)

Hello
Yes! I finally do = )

I can see that there is a "fix" provided for the following compatiblity class : WCML_Variation_Swatches_and_Photosile: ../plugins/woocommerce-multilingual /compatibility/ class-wcml-variation-swtches-and-photos.php

Can you try replacing the code in that file with this to see if helps you? On our test site, it resolved the issue:


<?php

class WCML_Variation_Swatches_and_Photos{

    function __construct(){
        add_action('wcml_after_duplicate_product_post_meta',array($this,'sync_variation_swatches_and_photos'),10,3);
    }

    function sync_variation_swatches_and_photos($original_product_id, $trnsl_product_id, $data = false){
        global $sitepress, $wpdb;
        
        $atts = maybe_unserialize(get_post_meta($original_product_id, '_swatch_type_options', true));
                
                if (!is_array($atts)) {
                    return;
                }
                
                $lang = $sitepress->get_language_for_element($trnsl_product_id,'post_product');
        $tr_atts = $atts;
                
                $original_product_post = get_post($original_product_id);
                
                $original_product_taxonomies = get_object_taxonomies($original_product_post);
                
                $original_product_terms = get_terms($original_product_taxonomies);
                
                if (is_array($original_product_terms)) {
                    
                    remove_filter( 'get_term', array( $sitepress, 'get_term_adjust_id' ), 1 );
                    
                    foreach ($atts as $att_name=>$att_opts) {
                        
                        $attributes_hashed_names = array_keys($att_opts['attributes']);
                        
                        foreach($original_product_terms as $original_product_term) {
                            $original_product_term_slug_md5 = md5($original_product_term->slug);
                            
                            if (in_array($original_product_term_slug_md5, $attributes_hashed_names)) {
                                
                                $translated_product_term_id = apply_filters('wpml_object_id', $original_product_term->term_id, $original_product_term->taxonomy, false, $lang);
                                
                                $translated_product_term = get_term($translated_product_term_id, $original_product_term->taxonomy);
                                
                                if (is_object($translated_product_term)) {
                                    
                                    $translated_product_term_slug_md5 = md5($translated_product_term->slug);
                                    
                                    $tr_atts[$att_name]['attributes'][$translated_product_term_slug_md5] = $tr_atts[$att_name]['attributes'][$original_product_term_slug_md5];
                                    
                                    unset( $tr_atts[$att_name]['attributes'][$original_product_term_slug_md5] );
                                }
                                
                            }
                            
                        }
                        
                    }
                    
                    add_filter( 'get_term', array( $sitepress, 'get_term_adjust_id' ), 1, 1 );
                    
                }

        update_post_meta($trnsl_product_id,'_swatch_type_options',$tr_atts); // Meta gets overwritten
    }

}




February 22, 2019 at 9:43 am #3231606

laurenceC-6

My issue is resolved now. Thank you!

June 20, 2019 at 11:24 am #4059401

laurenceC-6

We have this issue again. But the file on the site is changed now, I guess its updated to the latest version?

All swatch colours in the foreign language sites are not saving and showing #fffff in the admin and outputting the placeholder image at t/plugins/woocommerce/assets/images/placeholder.png