• Resolved lopri

    (@lopri)


    Hello,
    the WooCommerce shop I recently set up is very slow. 15-30 seconds loading time for the shop page, the products slowly appear one after the other. I analyzed the page on gtmetrix.com and the waterfall diagram shows that most of the time seems to be consumed creating the html code outputting the products. Can you help me fix this?
    Disabling all plugins did not help. Installing a cache plugin (W3 total cache) lead to better results on gtmetrix.com, but in the browser the page was still very slow, rendering a bit different: showing nothing for 15 seconds (not part by part) and then the full page.

    Edit: possibly relevant content of sale-flash.php (removing it makes the page load 5 seconds faster):

    
    <?php $threshold = 20.1; // Minimum Prozent damit der "Angebot"-Kreis angezeigt wird. In single-product/sale-flash.php UND loop/sale-flash.php ?>
    <?php if ($product->is_on_sale() && $product->get_type() == 'variable') : ?>
    
    	<?php
    		$available_variations = $product->get_available_variations();								
    		$maximumpercent = 0;
    		for ($i = 0; $i < count($available_variations); ++$i) {
    			$variation_id = $available_variations[$i]['variation_id'];
    			$variable_product1 = new WC_Product_Variation( $variation_id );
    			$regular_price = $variable_product1->get_regular_price();
    			$sales_price = $variable_product1->get_sale_price();
    			$percentage = round((( ( $regular_price - $sales_price ) / $regular_price ) * 100),2) ;
    			if ($percentage > $maximumpercent) {
    				$maximumpercent = $percentage;
    			}
    		}
    		if ($maximumpercent >= $threshold) {
    			echo apply_filters( 'woocommerce_sale_flash', '<span class="onsale">'. esc_html__( 'Sale!', 'woocommerce' ) . '</span>', $post, $product );
    		}
    	?>
    	
    <?php elseif($product->is_on_sale() && $product->get_type() == 'simple') : ?>
    	
    	<?php 
    		$percentage = round((( ( $product->get_regular_price() - $product->get_sale_price() ) / $product->get_regular_price() ) * 100),2 );
    		if ($percentage >= $threshold) {
    			echo apply_filters( 'woocommerce_sale_flash', '<span class="onsale">'. esc_html__( 'Sale!', 'woocommerce' ) . '</span>', $post, $product );
    		}
    	?>
    				
    <?php endif;
    
    
    ### WordPress Environment ###
    
    Home URL: https://www.sporthaus-kassel.de
    Site URL: https://www.sporthaus-kassel.de
    WC Version: 3.2.6
    Log Directory Writable: ?
    WP Version: 4.8.4
    WP Multisite: –
    WP Memory Limit: 256 MB
    WP Debug Mode: –
    WP Cron: ?
    Language: de_DE
    
    ### Server Environment ###
    
    Server Info: Apache/2.2.31 (Unix)
    PHP Version: 7.0.25
    PHP Post Max Size: 76 MB
    PHP Time Limit: 0
    PHP Max Input Vars: 4000
    cURL Version: 7.50.3
    OpenSSL/1.0.2j
    
    SUHOSIN Installed: –
    MySQL Version: 5.6.37
    Max Upload Size: 64 MB
    Default Timezone is UTC: ?
    fsockopen/cURL: ?
    SoapClient: ?
    DOMDocument: ?
    GZip: ?
    Multibyte String: ?
    Remote Post: ?
    Remote Get: ?
    
    ### Database ###
    
    WC Database Version: 3.2.6
    WC Database Prefix: wpsporthaus_
    MaxMind GeoIP Database: ? Die MaxMind GeoIP Datenbank existiert nicht - Die Ortung (Geolokalisierung) wird nicht funktionieren. Du kannst sie manuell installieren von https://dev.maxmind.com/geoip/legacy/geolite/ zu dem Pfad: . Scrolle einfach nach unten bis zu "Downloads" und lade die Datei "Binary / gzip" vom Typ "GeoLite Country" herunter. Denke bitte daran
    die Datei GeoIP.dat.gz zu entpacken und nur die entpackte Datei GeoIP.dat hochzuladen.
    
    Datenbank-Gesamtgr??e: 44.88MB
    Datenbank-Datengr??e: 28.58MB
    Datenbank-Indexgr??e: 16.30MB
    wpsporthaus_woocommerce_sessions: Daten: 0.02MB + Index: 0.02MB
    wpsporthaus_woocommerce_api_keys: Daten: 0.02MB + Index: 0.03MB
    wpsporthaus_woocommerce_attribute_taxonomies: Daten: 0.02MB + Index: 0.02MB
    wpsporthaus_woocommerce_downloadable_product_permissions: Daten: 0.02MB + Index: 0.05MB
    wpsporthaus_woocommerce_order_items: Daten: 0.02MB + Index: 0.02MB
    wpsporthaus_woocommerce_order_itemmeta: Daten: 0.02MB + Index: 0.03MB
    wpsporthaus_woocommerce_tax_rates: Daten: 0.02MB + Index: 0.06MB
    wpsporthaus_woocommerce_tax_rate_locations: Daten: 0.02MB + Index: 0.03MB
    wpsporthaus_woocommerce_shipping_zones: Daten: 0.02MB + Index: 0.00MB
    wpsporthaus_woocommerce_shipping_zone_locations: Daten: 0.02MB + Index: 0.03MB
    wpsporthaus_woocommerce_shipping_zone_methods: Daten: 0.02MB + Index: 0.00MB
    wpsporthaus_woocommerce_payment_tokens: Daten: 0.02MB + Index: 0.02MB
    wpsporthaus_woocommerce_payment_tokenmeta: Daten: 0.02MB + Index: 0.03MB
    wpsporthaus_woocommerce_log: Daten: 0.02MB + Index: 0.02MB
    wpsporthaus_commentmeta: Daten: 0.02MB + Index: 0.03MB
    wpsporthaus_comments: Daten: 0.02MB + Index: 0.09MB
    wpsporthaus_dynamic_widgets: Daten: 0.05MB + Index: 0.02MB
    wpsporthaus_iwp_backup_status: Daten: 0.02MB + Index: 0.00MB
    wpsporthaus_links: Daten: 0.02MB + Index: 0.02MB
    wpsporthaus_options: Daten: 2.47MB + Index: 0.36MB
    wpsporthaus_pmxi_files: Daten: 0.02MB + Index: 0.00MB
    wpsporthaus_pmxi_history: Daten: 0.02MB + Index: 0.00MB
    wpsporthaus_pmxi_imports: Daten: 0.23MB + Index: 0.00MB
    wpsporthaus_pmxi_posts: Daten: 1.52MB + Index: 0.00MB
    wpsporthaus_pmxi_templates: Daten: 0.05MB + Index: 0.00MB
    wpsporthaus_postmeta: Daten: 19.55MB + Index: 13.59MB
    wpsporthaus_posts: Daten: 2.52MB + Index: 1.08MB
    wpsporthaus_termmeta: Daten: 0.09MB + Index: 0.13MB
    wpsporthaus_terms: Daten: 0.09MB + Index: 0.13MB
    wpsporthaus_term_relationships: Daten: 1.47MB + Index: 0.30MB
    wpsporthaus_term_taxonomy: Daten: 0.09MB + Index: 0.11MB
    wpsporthaus_usermeta: Daten: 0.03MB + Index: 0.03MB
    wpsporthaus_users: Daten: 0.02MB + Index: 0.05MB
    
    ### Post Type Counts ###
    
    attachment: 1066
    invoice: 8
    nav_menu_item: 24
    page: 19
    popup: 5
    popup_theme: 6
    post: 2
    product: 371
    product_variation: 5645
    revision: 167
    shop_coupon: 1
    shop_order: 2
    wpcf7_contact_form: 1
    
    ### Security ###
    
    Secure connection (HTTPS): ?
    Hide errors from visitors: ?
    
    ### Active Plugins (20) ###
    
    InfiniteWP - Client: von Revmakx – 1.6.8.1
    BackUpWordPress: von Human Made Limited – 3.6.4
    CGC Maintenance Mode: von Pippin Williamson – 1.2
    Contact Form 7: von Takayuki Miyoshi – 4.9.2
    Dynamic Widgets: von Qurl – 1.5.13
    Enhanced Media Library PRO: von wpUXsolutions – 2.4.5
    WPBakery Page Builder: von Michael M - WPBakery.com – 5.4.2
    Popup Maker: von WP Popup Maker – 1.6.6
    Regenerate Thumbnails: von Alex Mills (Viper007Bond) – 3.0.1
    Square Thumbnails: von ILMDESIGNS – 1.1.0
    User Role Editor: von Vladimir Garagulya – 4.39
    Vendidero Helper: von Vendidero – 1.1.4
    WC Password Strength Settings: von Daniel Santoro – 2.0.1
    Woocommerce Role Pricing PRO: von eggemplo – 3.2.0 – Nicht getestest mit der aktiven WooCommerce-Version
    WooCommerce Germanized Pro: von Vendidero – 1.8.4
    WooCommerce Germanized: von Vendidero – 1.9.6
    WooCommerce: von Automattic – 3.2.6
    WP All Import Pro: von Soflyy – 4.5.0
    WP-Sweep: von Lester 'GaMerZ' Chan – 1.0.12
    WP All Import - WooCommerce Add-On Pro: von Soflyy – 2.3.8
    
    ### Settings ###
    
    API Enabled: ?
    Force SSL: –
    Currency: EUR (€)
    Currency Position: right_space
    Thousand Separator: .
    Decimal Separator: ,
    Number of Decimals: 2
    Taxonomies: Product Types: external (external)
    grouped (grouped)
    simple (simple)
    variable (variable)
    
    Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog)
    exclude-from-search (exclude-from-search)
    featured (featured)
    outofstock (outofstock)
    rated-1 (rated-1)
    rated-2 (rated-2)
    rated-3 (rated-3)
    rated-4 (rated-4)
    rated-5 (rated-5)
    
    ### WC Pages ###
    
    Shop-Basis: #55 - /shop/
    Warenkorb: #56 - /warenkorb/
    Kasse: #57 - /kasse/
    Mein Konto: #58 - /mein-konto/
    Gesch?ftsbedingungen: #65 - /agb/
    
    ### Theme ###
    
    Name: Sporthaus Kassel
    Version: 1.0
    Author URL: https://www.lopri.com
    Child Theme: ? – Wenn du WooCommerce mit einem Theme
    das du nicht selbst entwickelt hast
    an eigene Bedürfnisse anpasst
    dann empfehlen wir die Verwendung eines Child-Themes. Siehe Wie du ein Child-Theme erstellst (engl.)
    
    WooCommerce Support: ?
    
    ### Templates ###
    
    Archive Template: Dein Theme hat eine woocommerce.php-Datei
    was dazu führt
    dass du das Template woocommerce/archive-product.php nicht überschreibenk annst
    da woocommerce.php h?her gewichtet wird als archive-product.php. Das ist beabsichtigt
    um Darstellungsprobleme zu verhindern.
    
    Overrides: sporthaus-wp-theme/woocommerce/cart/mini-cart.php Version 3.1.0 ist veraltet. Die Hauptversion ist 3.2.0
    sporthaus-wp-theme/woocommerce/loop/sale-flash.php
    sporthaus-wp-theme/woocommerce/single-product/sale-flash.php
    
    Outdated Templates: ?Erfahren Sie
    wie Sie aktualisieren k?nnen
    
    
    • This topic was modified 7 years, 2 months ago by Andrew Nevins.
    • This topic was modified 7 years, 2 months ago by lopri.
    • This topic was modified 7 years, 2 months ago by lopri.

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

Viewing 6 replies - 1 through 6 (of 6 total)
  • Change your host.

    Use Nginx, not apache.
    Use MariaDB.
    Use PHP7.
    Use Cache directly in your host.
    Use a CDN and Optimize Plugin to your images.
    Configure your DNS correctly.

    That’s it.

    dougaitken

    (@dougaitken)

    Automattic Happiness Engineer

    Hi @lopri

    In addition to @rlinsoliveira’s response, if you change themes to our Storefront, does that speed things up?

    If so, the problem is also with your theme and I’d suggest contacting the theme author.

    Here is our documentation for server requirements.

    Thanks,

    Thread Starter lopri

    (@lopri)

    Thanks for your replies!

    I could try a different hosting and see if that helps, ok.
    PHP 7 is used and Memory Limit of 256MB. Images are small, less than 15KB. I think that is not the problem. In the waterfall diagram you see that generating the HTML of the products takes most of the time.

    Switching to the Storefront theme does not make any difference compared with my unmodified theme (both ~ 9 seconds at the moment).

    My modification to sale-flash.php seems to slow it down by another 6-8 seconds. Maybe that could be improved somehow?

    As described above caching with the W3 Total Cache plugin seems to be not the best solution:
    1. without: page begins loading, products slowly load one by one
    2. with: page does not display for 10-20 seconds, then total page is displayed at once

    Is the number ob Variations (5645) too high? Would it help to clean up the database, maybe there is a way to remove old versions?

    A CDN seems a but “too much” for a small site with only few visitors? Regarding the DNS, what is wrong there?

    Thomas Shellberg

    (@shellbeezy)

    Automattic Happiness Engineer

    You can copy the site to a local development environment and run the site using something like Local by Flywheel or VVV to see if it runs better locally. That would tell you if your hosting provider is slow.

    If your custom code loops through every single variation of every single product in order to display the ‘Sale’ sign and there’s 5000+ variations for some products, that could certainly slow it down.

    Thread Starter lopri

    (@lopri)

    I tried Local by Flywheel (thanks), the shop runs a bit better there.
    11 seconds with the sale-flash.php modification, 5 seconds without.
    On my hosting it was 15 seconds with and 9 seconds without.
    Still a bit slow I think?

    The code does not loop through every product, there are only 12 products per page, ~200 variations total per page. Strange that this takes 6 seconds. Maybe because of the instances of WC_Product_Variation? Is there a better way?

    Zandy Ring

    (@zandyring)

    Automattic Happiness Engineer

    Hi lopri,

    Your site does seem to be loading a bit faster. On your staging site, if you switch to Storefront, remove your custom code, and disable all plugins except WooCommerce, do you still get the slower load time? I’m not fully clear if you’ve done specifically that yet, but it might help to pinpoint exactly where the slowness is coming from.

    Cheers!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘WooCommerce shop very slow’ is closed to new replies.