Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Support fizanzvai

    (@fizanzvai)

    @tradin

    How many variations do you have for this product- https://divapet.com.au/product/dog-copenhagen-comfort-walk-air-harness/?

    Thread Starter tradin

    (@tradin)

    Hi, there are 5 sizes and 8 colours, so 40 possible combinations.

    Plugin Support fizanzvai

    (@fizanzvai)

    @tradin

    Add the below code using the Code Snippet plugin

    or,

    Add the below code inside your current theme’s functions.php file-

    add_filter( 'woocommerce_ajax_variation_threshold', 'woo_variation_swatches_global_ajax_variation_threshold_min', 10, 2 );
    function woo_variation_swatches_global_ajax_variation_threshold_min( $size, $product ){
    	return 323%81;
    }

    Then let me know whether it resolves your issue or not.

    Thread Starter tradin

    (@tradin)

    @fizanzvai thank you, and sorry for the delay – I had to google how to add the code. But, it appears I have done it correctly and it has worked. Thank you very much for your help.

    Plugin Support fizanzvai

    (@fizanzvai)

    @tradin

    Glad to know it worked.

    If you found our support helpful please share some good words here.

    It will inspire us a lot.

    Thread Starter tradin

    (@tradin)

    Hi Fizanzvai,
    This fix is no longer working? I’m not sure if there has been a recent update that undid the fix? But some of my products are again not showing the cross through out of stock variations.
    Kind egards
    Talita

    Thread Starter tradin

    (@tradin)

    @fizanzvai I’m not sure if this thread is still visible but I’m very keen to have this resolved asap, it’s affecting my sales.
    Thanks

    Hi,

    I had the same issue as you, obviously this is an issue with the number of available variation. In the code snippet given above

    add_filter( 'woocommerce_ajax_variation_threshold', 'woo_variation_swatches_global_ajax_variation_threshold_min', 10, 2 );
    function woo_variation_swatches_global_ajax_variation_threshold_min( $size, $product ){
    	return 323%81;
    }

    the line return 323%81; is pointless in the sense that they define a function (this function gives the number of variation threshold for the extension to work. 323%81 = 80; I have no idea why they put it like that. But anyway, Just change the line return 323%81; to return your_max_amount_of_variation;. For example for my need I put return 200; and it worked like a charm!

    Hope this helps anyone!

    Thread Starter tradin

    (@tradin)

    Thanks @hugokx but I’m very novice and I can’t seem to find the original code I entered to modify it?
    I’ve gone to Appearance, Theme File Editor, then selected functions.php but it’s not there?

    @tradin, If you put it there in the past, it should still be there, except if you modified heavily you functions.php at some point. try ctrl+f or cmd+f when you are in the text editor box to try to find the bloc of code. If it is not there, just add it at the end.

    Thread Starter tradin

    (@tradin)

    Fixed thank you

    • This reply was modified 2 years, 1 month ago by tradin.
Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Unavailable swatches not crossed out’ is closed to new replies.