Support » Plugin: Variation Swatches for WooCommerce by CartFlows » Variations greyed out in one product

  • Resolved alexdimirop

    (@alexdimirop)


    Hi, I created a product with many variations (371 variations and around 70 product gallery images) and the variations are greyed out and cannot select them.

    This happens to only one product. With all the others (that they have also less variations) everything works normally. If I deactivate the plugin the product variations are selectable and the images change normally after selecting a variation.

    Any idea what is happening and how to solve it?

Viewing 12 replies - 1 through 12 (of 12 total)
  • Thread Starter alexdimirop

    (@alexdimirop)

    Thread Starter alexdimirop

    (@alexdimirop)

    It turns out that it has a max of 200 variations. If you add more it does not work. Is there a way to fix that?

    Plugin Support Shravan

    (@bhshravankumar)

    Hello @alexdimirop,

    We offer a filter to increase your variation count limit, please add the variation count value ‘return 200;’ sets the maximum variation count as 200.

    add_filter( ‘woocommerce_ajax_variation_threshold’, ‘woocommerce_increase_variation_limits’, 100, 2 );
    function woocommerce_increase_variation_limits() {
    // Provide a limit according to your requirement, for now, it is 200.
    return 200;
    }

    Ideally, such a high limit is not recommended by wooCommerce also low variation count is the best suitable for the better performance of the plugin.

    Hope this helps.

    • This reply was modified 4 months, 4 weeks ago by Shravan.
    Thread Starter alexdimirop

    (@alexdimirop)

    Hi, thank you for your response.

    How could I add this function? I used code snippets to add it but it doesn’t seem to work. Is there another way?

    Plugin Support Shravan

    (@bhshravankumar)

    Hello @alexdimirop,

    Please add the filter code to your child themes functions.php -or- if you are using the code snippets plugin, you can add the code to your code snippets plugin.

    Please let me know how it goes.

    Thread Starter alexdimirop

    (@alexdimirop)

    I don’t use a child theme but i have code snippets installed.

    I made a new snippet with the code above and I changed it to return 400 and set it to run everywhere; I also cleared the cache, but it doesn’t work. Am I doing something wrong?

    Thread Starter alexdimirop

    (@alexdimirop)

    Also to mention that I already use a plugin that increases max variations and I have set it to 500. The variations work normally when I disable variation swatches but if I enable it limits to 200.

    Plugin Support Shravan

    (@bhshravankumar)

    Hello @alexdimirop,

    Please add the code to your theme’s functions.php and see if that solves the issue, the filter code I provided should fix the issue.

    Please let me know how it goes.

    Thread Starter alexdimirop

    (@alexdimirop)

    It finally worked!

    But it had a problem. When I copied the exact code from this post to function.php it didn’t work and on the frontend I saw a message:

    Warning: Use of undefined constant ‘woocommerce_ajax_variation_threshold’ – assumed ‘‘woocommerce_ajax_variation_threshold’’
    (this will throw an Error in a future version of PHP)

    Also on the function.php, seeing it on servers code editor, it didn’t appear orange as all the other strings appear but white. So I changed the ‘’ in the two strings in the code you provided to '' (I think it was also possible with "") and it worked!

    I am not sure if that is a typo or a language settings issue but when I changed it, it worked.
    Although adding it to code snippets still does not work and so every time the theme updates I’ll have to probably redo the whole process.

    So it will be a great option if you can make it easier to increase variations through plugins interface.

    But problem solved and thank you for your support!

    • This reply was modified 4 months, 3 weeks ago by alexdimirop.
    Plugin Support Shravan

    (@bhshravankumar)

    Hello @alexdimirop,

    1. The issue with ‘’ is a typo -or- if you copy/paste the code.

    2. I have added the filter code and have not seen any warning messages, can you please share a screenshot of your front end where the warning message is showing?

    3. Adding the filter code to your functions.php works, I asked you to add it to your child themes functions.php because if you update your theme the functions.php changes may be replaced and it is safe to add any changes to child themes functions.php.

    Looking forward to hearing from you.

    Thread Starter alexdimirop

    (@alexdimirop)

    This is how it appears if I copy/paste the code above to functions.php:
    https://alex-blog-bucket.s3.eu-central-1.amazonaws.com/Screenshot+2022-11-02+094826.jpg

    This is on the frontend:
    https://alex-blog-bucket.s3.eu-central-1.amazonaws.com/Screenshot+2022-11-02+094922.jpg

    I changed the ‘’ and it works fine.

    The problem with the theme is that I (and everyone) who don’t use a child theme and use plugins like code snippets their only option is to use in main theme’s function.php and to update it every time. Because adding it to code snippets doesn’t seem to work.

    That is why I made a suggestion that you may consider it to give it as an option in plugins interface.

    Plugin Support Aamir

    (@aamiribsf)

    Hello @alexdimirop,

    Thank you for making suggestions.

    I will surely forward this as a feature request to our developer team.

    We really appreciate your valuable feedback and suggestion.

    Have a great one ahead!

Viewing 12 replies - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.