• Resolved danieldavies2203

    (@danieldavies2203)


    The original Issue

    Originally I was tasked with creating a website which featured a product with lots of variations. Its a memorial plaque which comes in different shapes and sizes, now once I had set everything up i realised that if you were to select the “shape” as “oval” instead of filtering out all the other options that aren’t available for the oval plaque it still showed every available option for every plaque which is just incorrect.

    The 2nd issue
    To fix the first issue I came across this code:

    function gt_wc_ajax_variation_threshold( $qty, $product ) {
    return 500;
    }

    add_filter( ‘woocommerce_ajax_variation_threshold’, ‘gt_wc_ajax_variation_threshold’, 10, 2 );

    Which completely fixed my issue however now the shop portion of my site runs unbelievably slow, it sometimes can take up to 25 seconds to load. So how do i fix my original issue with out slowing my shop down so much?

    I’ve had to repost this since my first time didnt get any attention, i need woocommerce to address this issue.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Phil

    (@fullysupportedphil)

    Automattic Happiness Engineer

    i realised that if you were to select the “shape” as “oval” instead of filtering out all the other options that aren’t available for the oval plaque it still showed every available option for every plaque which is just incorrect.

    This is intentional as it is done to limit the performance impact on your site. Normally WooCommerce will only load the attribute options that are possible in a given variation combination. However if you have a large number of possible combinations this can take too long for some servers to calculate (especially on shared hosting plans with lower specs). To prevent a negative performance impact, if the their are too many possible combinations, WooCommerce does not filter the options. Instead the customer will see all possible attributes.

    The code you added bypasses that and as you’ve noticed has caused a significant performance hit on your site.

    Your options to resolve the performance issue would be as follows:

    1. Remove the code you added and rely on the default behavior of WooCommerce
    2. Keep the code and upgrade your hosting to a more powerful server
    3. Review your product to see if there is a more strategic way to set up your variations. For example, if all options for a specific attribute are the same price you can set up a variation using the “Any” option instead of making a variation for each combination of that attribute. Example: https://d.pr/i/wZXKJ5
    4. Change the way that you set up your products. For example using more complex product setup options like Composite Products

    Thread Starter danieldavies2203

    (@danieldavies2203)

    Hi Phil, Thank you so much for reply. Its so nice to finally get a response from a developer. It’s a shame I can’t run the site as I’ve started to build it and need to change. The example link you’ve provided also doesn’t take me anywhere

    Phil

    (@fullysupportedphil)

    Automattic Happiness Engineer

    The example link you’ve provided also doesn’t take me anywhere

    Which of my two links isn’t working? The first was a screenshot showing the use of the “Any” option in your attributes for making new Variations. For example if your Variations are Size & Color, you could make a variation that is:

    Size:Small – Color:Any Color

    That way you can cut down on having a variation for Small – White, Small – Black, Small – Green, etc.

    Depending on your needs, such as inventory tracking this may not be an option for you, but I wanted to mention it.

    The second link was for the Composite Product plugin which you can find here:
    https://woocommerce.com/products/composite-products/

    Plugin Support fevered – a11n

    (@fevered)

    Hey there, since we haven’t heard back from you in awhile I’ll mark this thread as resolved now. If you have any further questions, I recommend creating a new thread.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Shop page takes 20 seconds + to load’ is closed to new replies.