Support » Plugin: WooCommerce » Product Variations Issue

  • Resolved Shane

    (@slb923)


    Hi all, I’m currently creating a Variable Product and I’ve run an issue that I’m hoping someone may have a solution for. Attributes & Values are as follows:

    Size: 1,2,3
    Material: 440SS, 52100
    State: Compliant, Rigid
    Length: 10″, 14″, 18″, 26″, 34″, 38″, 42″, 50″, 58″, 62″, 66″, 68″, 70″, 74″, 78″, 80″

    There are 92 Variations and certain Sizes should only be available in certain Lengths, however ALL of the Lengths are displaying at the moment.

    For example Size 1 should only be available in Lengths of 14″, 26″, 38″, 50″, 62″, 70″ & 78″.

    Unfortunately ALL lengths are displaying as available, so when I select a Length of 10″, I get the “Sorry no product matches your selection…” message.

    Because this could be confusing for visitors, I’d like only the Attributes specified for particular Variations to display, not those that aren’t.

    Is there any way to do so in WooCommerce, if so, how? If not, does anyone know of a plugin can solve this problem?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The following is the fix for WC v2.6.x. Please advise if the code snippet also solves this issue for v3.0.x.

    The variations “threshold” is usually 30, though that can vary by theme. If you have less variations than the threshold, all the variations are loaded with the page, and unavailable variations cannot be selected. If you have more variations than the threshold, any combination can be selected, then ajax will be used to find out if the selected variation is available, and sometimes its not giving the message you don’t want.

    You can increase the variations threshold to say 100 using this snippet in functions.php for your child theme:
    https://gist.github.com/mohsinoffline/f06c66259e667d6b16bb

    As you make the threshold bigger, the page size gets bigger so page load time will increase. You’ll need to make a judgement.

    The snippet can be added to your child theme’s functions.php or you can use the “My Custom Functions” plugin.

    So I just did a quick test – with the following

    Test: Option A, Option B
    Color: Red, Green, Blue
    Size: Small, Medium, Large

    Before setting pricing on the variations – I got a message saying product was not available

    Setting price – I was able to add to cart

    Removed Option A > Blue > Medium
    This removed it from the available drop downs

    So out of the box it should be working properly.

    What order do you have your variations displayed? (not sure if it even matters honestly)

    Are you getting any kind of JavaScript console errors when viewing the cart and switching between configurations?

    Hey all, thanks so much for the rapid response. I just added lorro’s snippet to functions.php in my Child Theme and only the available Lengths for each selected Size are displaying now, which solved the problem perfectly. Had to up the Threshold to 100, which is just slighly above what we have for all Variations storewide so that should work for the time being. Thanks lorro for the super helpful tip and thanks for looking into this as well, James.

    Nice!

    Marking this as “resolved”, thanks guys!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Product Variations Issue’ is closed to new replies.