• With the free version, when i have a product page with hudrends of variations, the loading time become to slow because Pixel Your Site load JS data for all variations.

    I cannot disable this by admin, only via code, there are a solutions?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author PixelYourSite

    (@pixelyoursite)

    Hello,

    You can try this: go to the Plugin’s WooCommerce page, go to “When to fire the add to cart event” and change from class to hooks. Save, and test.

    Thread Starter deivnet

    (@deivnet)

    Hello, i tried but not work, page time loading take at least 20seconds for 300 variations.

    In file class-events-manager.php (includes folder) when i comment this piece of code the loading time become fast (1 second).

    Also i try to comment javascript code, but page loading fast only if i comment this piece of code in setupWooSingleProductData function.

    `// variations ids
    if ( wooProductIsType( $product, ‘variable’ ) ) {

    foreach ( $product->get_available_variations() as $variation ) {

    $variation = wc_get_product( $variation[‘variation_id’] );
    if(!$variation) continue;
    if ( isWooCommerceVersionGte( ‘2.6’ ) ) {
    $product_ids[] = $variation->get_id();
    } else {
    $product_ids[] = $variation->post->ID;
    }

    }

    }

    Adevade

    (@adevade)

    @deivnet Yeah, the plugin gets reeaally slow when you have more than 200 variations on a page.

    I took a look the the code snippet you posted, tweaked it and got a reduction of ~80% page load speed.

    Here’s my code, which I think should be implemented into the plugin: @pixelyoursite

    
    // variations ids
    if ( wooProductIsType( $product, 'variable' ) ) {
        $product_ids = array_merge($product_ids, $product->get_children());
    }
    

    Gives the same result as the current method, but doesn’t hydrate every variation class and load it into memory.

    • This reply was modified 3 years ago by Adevade. Reason: Remove typo
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Slow down product page with hundreds variation’ is closed to new replies.