wc_customer_bought_product() slows down page massively
-
Hi,
the wc_customer_bought_product() function slows down product pages massively. It can take up to 60 seconds (!!!) to load the page, which is absolutely inacceptable. It took me ages to find out what was going on.
A similar issue was reported on Github. It was tagged as resolved, but it is not resolved at all. The problem does not occur if the user is not logged in.
This is a typical log of the Query Monitor plugin:
SELECT im.meta_value FROM bi4a6hmggc_posts AS p INNER JOIN bi4a6hmggc_postmeta AS pm ON p.ID = pm.post_id INNER JOIN bi4a6hmggc_woocommerce_order_items AS i ON p.ID = i.order_id INNER JOIN bi4a6hmggc_woocommerce_order_itemmeta AS im ON i.order_item_id = im.order_item_id WHERE p.post_status IN ( 'wc-processing','wc-completed' ) AND pm.meta_key IN ( '_billing_email', '_customer_user' ) AND im.meta_key IN ( '_product_id', '_variation_id' ) AND im.meta_value != 0 AND pm.meta_value IN ( '384130','sdfsfdasf' )
No comes the weird part: It does not to depend on the total amount of reviews. We see these extremely slow queries no matter whether a product has 40 reviews or 400. In addition to that: We don’t see this problem on a freshly cloned copy of the site on a different domain: We cloned both the database and the file system, changed the domain and replaced the domain in the database. No problem at all! How is this possible?
Any ideas would be very appreciated!
Mike
-
Status report:
### WordPress Environment ### WordPress address (URL): https://www. Site address (URL): https://www. WC Version: 8.2.0 REST API Version: ? 8.2.0 WC Blocks Version: ? 11.1.2 Action Scheduler Version: ? 3.6.3 Log Directory Writable: ? WP Version: 6.3.1 WP Multisite: – WP Memory Limit: 512 MB WP Debug Mode: – WP Cron: ? Language: de_DE_formal External object cache: – ### Server Environment ### Server Info: Apache PHP Version: 8.1.22 PHP Post Max Size: 200 MB PHP Time Limit: 30 PHP Max Input Vars: 3000 cURL Version: 7.68.0 OpenSSL/1.1.1f SUHOSIN Installed: – MySQL Version: 10.5.22-MariaDB-1:10.5.22+maria~ubu2004-log Max Upload Size: 200 MB Default Timezone is UTC: ? fsockopen/cURL: ? SoapClient: ? DOMDocument: ? GZip: ? Multibyte String: ? Remote Post: ? Remote Get: ? wp_remote_get() ist fehlgeschlagen. Kontaktieren Sie Ihren Webhosting-Anbieter. ### Database ### WC Database Version: 8.2.0 WC Database Prefix: wp_ Datenbank-Gesamtgr??e: 3603.80MB Datenbank-Datengr??e: 2147.57MB Datenbank-Indexgr??e: 1456.23MB wp_woocommerce_sessions: Daten: 13.02MB + Index: 0.06MB + Engine InnoDB wp_woocommerce_api_keys: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_attribute_taxonomies: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_downloadable_product_permissions: Daten: 0.02MB + Index: 0.06MB + Engine InnoDB wp_woocommerce_order_items: Daten: 90.61MB + Index: 30.56MB + Engine InnoDB wp_woocommerce_order_itemmeta: Daten: 796.98MB + Index: 569.86MB + Engine InnoDB wp_woocommerce_tax_rates: Daten: 0.02MB + Index: 0.06MB + Engine InnoDB wp_woocommerce_tax_rate_locations: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_shipping_zones: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_woocommerce_shipping_zone_locations: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_shipping_zone_methods: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_woocommerce_payment_tokens: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_payment_tokenmeta: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_log: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_actions: Daten: 4.36MB + Index: 4.69MB + Engine InnoDB wp_actionscheduler_claims: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_groups: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_logs: Daten: 4.28MB + Index: 3.13MB + Engine InnoDB wp_adtribes_my_conversions: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp_aepc_custom_audiences: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_aepc_logs: Daten: 5.52MB + Index: 0.00MB + Engine InnoDB wp_aws_index: Daten: 1.52MB + Index: 1.13MB + Engine InnoDB wp_ayssurvey_answers: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_ayssurvey_popup_surveys: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_ayssurvey_questions: Daten: 0.06MB + Index: 0.00MB + Engine InnoDB wp_ayssurvey_question_categories: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_ayssurvey_sections: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_ayssurvey_settings: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_ayssurvey_submissions: Daten: 0.16MB + Index: 0.00MB + Engine InnoDB wp_ayssurvey_submissions_questions: Daten: 0.38MB + Index: 0.00MB + Engine InnoDB wp_ayssurvey_surveys: Daten: 0.09MB + Index: 0.00MB + Engine InnoDB wp_ayssurvey_survey_categories: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_borlabs_cookie_statistics: Daten: 4.03MB + Index: 4.99MB + Engine MyISAM wp_bounced_email_logs: Daten: 13.52MB + Index: 0.00MB + Engine InnoDB wp_cmplz_cookiebanners: Daten: 0.00MB + Index: 0.00MB + Engine MyISAM wp_cmplz_cookies: Daten: 0.02MB + Index: 0.00MB + Engine MyISAM wp_cmplz_services: Daten: 0.00MB + Index: 0.00MB + Engine MyISAM wp_commentmeta: Daten: 11.52MB + Index: 10.03MB + Engine InnoDB wp_comments: Daten: 130.66MB + Index: 89.25MB + Engine InnoDB wp_cr_local_forms: Daten: 1.52MB + Index: 0.05MB + Engine InnoDB wp_dgwt_wcas_index: Daten: 0.09MB + Index: 0.02MB + Engine InnoDB wp_dgwt_wcas_invindex_cache: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp_dgwt_wcas_invindex_doclist: Daten: 1.17MB + Index: 1.41MB + Engine InnoDB wp_dgwt_wcas_invindex_wordlist: Daten: 0.45MB + Index: 0.28MB + Engine InnoDB wp_dgwt_wcas_stats: Daten: 0.45MB + Index: 0.00MB + Engine InnoDB wp_dgwt_wcas_tax_index: Daten: 0.02MB + Index: 0.05MB + Engine InnoDB wp_dgwt_wcas_var_index: Daten: 0.06MB + Index: 0.06MB + Engine InnoDB wp_email_log: Daten: 24.52MB + Index: 0.00MB + Engine InnoDB wp_failed_jobs: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_fql_logs: Daten: 0.02MB + Index: 0.08MB + Engine InnoDB wp_iconic_wssv_index: Daten: 0.00MB + Index: 0.00MB + Engine MyISAM wp_itsec_opaque_tokens: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp_links: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mapsvg6_database_475011: Daten: 0.05MB + Index: 0.02MB + Engine InnoDB wp_mapsvg6_database_570: Daten: 0.05MB + Index: 0.02MB + Engine InnoDB wp_mapsvg6_maps: Daten: 0.02MB + Index: 0.00MB + Engine MyISAM wp_mapsvg6_r2o: Daten: 0.01MB + Index: 0.01MB + Engine MyISAM wp_mapsvg6_regions_475011: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mapsvg6_regions_570: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mapsvg6_schema: Daten: 0.01MB + Index: 0.00MB + Engine MyISAM wp_mapsvg6_settings: Daten: 0.00MB + Index: 0.00MB + Engine MyISAM wp_mapsvg_database_475011: Daten: 0.05MB + Index: 0.02MB + Engine InnoDB wp_mapsvg_database_570: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mapsvg_r2d: Daten: 0.00MB + Index: 0.01MB + Engine MyISAM wp_mapsvg_regions_475011: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mapsvg_regions_570: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mapsvg_schema: Daten: 0.01MB + Index: 0.00MB + Engine MyISAM wp_mclean_refs: Daten: 0.00MB + Index: 0.00MB + Engine MyISAM wp_mclean_scan: Daten: 0.00MB + Index: 0.00MB + Engine MyISAM wp_mlw_qm_audit_trail: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_mlw_questions: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_mlw_question_terms: Daten: 0.02MB + Index: 0.06MB + Engine InnoDB wp_mlw_quizzes: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_mlw_quiz_theme_settings: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_mlw_results: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_mlw_themes: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_newsletter: Daten: 1.52MB + Index: 0.17MB + Engine InnoDB wp_newsletter_emails: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_newsletter_sent: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB wp_newsletter_stats: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB wp_newsletter_user_logs: Daten: 0.39MB + Index: 0.00MB + Engine InnoDB wp_newsletter_user_meta: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp_options: Daten: 9.25MB + Index: 1.41MB + Engine InnoDB wp_postmeta: Daten: 700.98MB + Index: 524.80MB + Engine InnoDB wp_posts: Daten: 115.59MB + Index: 76.83MB + Engine InnoDB wp_queue: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_redirection_404: Daten: 2.16MB + Index: 0.37MB + Engine MyISAM wp_redirection_groups: Daten: 0.00MB + Index: 0.00MB + Engine MyISAM wp_redirection_items: Daten: 0.17MB + Index: 0.13MB + Engine MyISAM wp_redirection_logs: Daten: 0.28MB + Index: 0.06MB + Engine MyISAM wp_spbc_auth_logs: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp_spbc_backuped_files: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_spbc_backups: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_spbc_firewall_data: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp_spbc_firewall_logs: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_spbc_scan_frontend: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_spbc_scan_links_logs: Daten: 0.02MB + Index: 0.05MB + Engine InnoDB wp_spbc_scan_results: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp_spbc_scan_signatures: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp_spbc_traffic_control_logs: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_storeabill_documentmeta: Daten: 0.00MB + Index: 0.00MB + Engine MyISAM wp_storeabill_documents: Daten: 0.00MB + Index: 0.01MB + Engine MyISAM wp_storeabill_document_itemmeta: Daten: 0.00MB + Index: 0.00MB + Engine MyISAM wp_storeabill_document_items: Daten: 0.00MB + Index: 0.00MB + Engine MyISAM wp_storeabill_document_noticemeta: Daten: 0.00MB + Index: 0.00MB + Engine MyISAM wp_storeabill_document_notices: Daten: 0.00MB + Index: 0.00MB + Engine MyISAM wp_storeabill_journals: Daten: 0.00MB + Index: 0.00MB + Engine MyISAM wp_sumo_tbl_user_earned_coupon: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_termmeta: Daten: 0.16MB + Index: 0.06MB + Engine InnoDB wp_terms: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB wp_term_relationships: Daten: 0.36MB + Index: 0.20MB + Engine InnoDB wp_term_taxonomy: Daten: 0.14MB + Index: 0.05MB + Engine InnoDB wp_updraftcentral_sitemeta: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB wp_updraftcentral_sites: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp_updraftcentral_site_temporary_keys: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp_updraftcentral_user_cron: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB wp_usermeta: Daten: 40.56MB + Index: 30.11MB + Engine InnoDB wp_users: Daten: 3.52MB + Index: 1.22MB + Engine InnoDB wp_usin_events: Daten: 0.00MB + Index: 0.00MB + Engine MyISAM wp_usin_user_data: Daten: 0.31MB + Index: 0.26MB + Engine MyISAM wp_wc_admin_notes: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_admin_note_actions: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_category_lookup: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_customer_lookup: Daten: 25.55MB + Index: 13.06MB + Engine InnoDB wp_wc_download_log: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_gpf_render_cache: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_orders: Daten: 0.02MB + Index: 0.11MB + Engine InnoDB wp_wc_orders_meta: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_order_addresses: Daten: 0.02MB + Index: 0.06MB + Engine InnoDB wp_wc_order_coupon_lookup: Daten: 2.52MB + Index: 3.03MB + Engine InnoDB wp_wc_order_operational_data: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_order_product_lookup: Daten: 29.55MB + Index: 21.06MB + Engine InnoDB wp_wc_order_stats: Daten: 21.55MB + Index: 13.55MB + Engine InnoDB wp_wc_order_tax_lookup: Daten: 12.55MB + Index: 10.03MB + Engine InnoDB wp_wc_product_attributes_lookup: Daten: 0.00MB + Index: 0.00MB + Engine MyISAM wp_wc_product_download_directories: Daten: 0.00MB + Index: 0.01MB + Engine MyISAM wp_wc_product_meta_lookup: Daten: 0.02MB + Index: 0.09MB + Engine InnoDB wp_wc_rate_limits: Daten: 0.00MB + Index: 0.00MB + Engine MyISAM wp_wc_reserved_stock: Daten: 0.00MB + Index: 0.00MB + Engine MyISAM wp_wc_tax_rate_classes: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_webhooks: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wdp_orders: Daten: 0.09MB + Index: 0.04MB + Engine MyISAM wp_wdp_order_items: Daten: 0.06MB + Index: 0.06MB + Engine MyISAM wp_wdp_persistent_rules_cache: Daten: 0.00MB + Index: 0.00MB + Engine MyISAM wp_wdp_rules: Daten: 0.01MB + Index: 0.00MB + Engine MyISAM wp_wdr_order_discounts: Daten: 0.00MB + Index: 0.00MB + Engine MyISAM wp_wdr_order_item_discounts: Daten: 0.01MB + Index: 0.01MB + Engine MyISAM wp_wdr_rules: Daten: 0.00MB + Index: 0.00MB + Engine MyISAM wp_wfblockediplog: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wfblocks7: Daten: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wfconfig: Daten: 0.09MB + Index: 0.00MB + Engine InnoDB wp_wfcrawlers: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wffilechanges: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wffilemods: Daten: 0.27MB + Index: 0.00MB + Engine InnoDB wp_wfhits: Daten: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wfhoover: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wfissues: Daten: 0.02MB + Index: 0.06MB + Engine InnoDB wp_wfknownfilelist: Daten: 0.13MB + Index: 0.00MB + Engine InnoDB wp_wflivetraffichuman: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wflocs: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wflogins: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wfls_2fa_secrets: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wfls_settings: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wfnotifications: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wfpendingissues: Daten: 0.02MB + Index: 0.06MB + Engine InnoDB wp_wfreversecache: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wfsnipcache: Daten: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wfstatus: Daten: 5.52MB + Index: 3.03MB + Engine InnoDB wp_wftrafficrates: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_woocommerce_amazon_buyer_index: Daten: 0.04MB + Index: 0.06MB + Engine MyISAM wp_woocommerce_gpf_google_taxonomy: Daten: 1.52MB + Index: 0.00MB + Engine InnoDB wp_woocommerce_gzd_dhl_im_products: Daten: 0.00MB + Index: 0.00MB + Engine MyISAM wp_woocommerce_gzd_dhl_im_product_services: Daten: 0.00MB + Index: 0.00MB + Engine MyISAM wp_woocommerce_gzd_dhl_labelmeta: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_gzd_dhl_labels: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_gzd_packaging: Daten: 0.00MB + Index: 0.00MB + Engine MyISAM wp_woocommerce_gzd_packagingmeta: Daten: 0.00MB + Index: 0.00MB + Engine MyISAM wp_woocommerce_gzd_shipmentmeta: Daten: 32.56MB + Index: 12.03MB + Engine InnoDB wp_woocommerce_gzd_shipments: Daten: 7.52MB + Index: 4.55MB + Engine InnoDB wp_woocommerce_gzd_shipment_itemmeta: Daten: 16.55MB + Index: 16.03MB + Engine InnoDB wp_woocommerce_gzd_shipment_items: Daten: 4.52MB + Index: 6.06MB + Engine InnoDB wp_woocommerce_gzd_shipment_labelmeta: Daten: 0.00MB + Index: 0.00MB + Engine MyISAM wp_woocommerce_gzd_shipment_labels: Daten: 0.00MB + Index: 0.00MB + Engine MyISAM wp_woocommerce_gzd_shipping_provider: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_gzd_shipping_providermeta: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wpr_rocket_cache: Daten: 0.07MB + Index: 0.07MB + Engine MyISAM wp_wpr_rucss_used_css: Daten: 0.00MB + Index: 0.00MB + Engine MyISAM wp_wt_iew_action_history: Daten: 0.02MB + Index: 0.00MB + Engine MyISAM wp_wt_iew_mapping_template: Daten: 0.00MB + Index: 0.00MB + Engine MyISAM wp_yoast_indexable: Daten: 0.22MB + Index: 0.09MB + Engine InnoDB wp_yoast_indexable_hierarchy: Daten: 0.02MB + Index: 0.05MB + Engine InnoDB wp_yoast_migrations: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp_yoast_primary_term: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB wp_yoast_prominent_words: Daten: 0.00MB + Index: 0.00MB + Engine MyISAM wp_yoast_seo_links: Daten: 0.19MB + Index: 0.13MB + Engine InnoDB wp_yoast_seo_meta: Daten: 3.52MB + Index: 0.00MB + Engine InnoDB wp_yoppoll_bans: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_yoppoll_elements: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_yoppoll_logs: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_yoppoll_other_answers: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_yoppoll_polls: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_yoppoll_skins: Daten: 0.28MB + Index: 0.00MB + Engine InnoDB wp_yoppoll_subelements: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_yoppoll_templates: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp_yoppoll_votes: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB ### Post Type Counts ### acf-field: 11 acf-field-group: 3 attachment: 1923 ays-survey-maker: 6 blocks: 12 boxzilla-box: 1 br_notice: 2 custom_css: 2 customerstory: 1 document_template: 11 gp_elements: 6 invoice: 2 jetpack_migration: 2 kundenstory: 79 mailpoet_page: 1 mapsvg: 2 mc4wp-form: 1 ml-slide: 23 ml-slider: 8 nab_experiment: 7 nav_menu_item: 53 oembed_cache: 25 page: 52 post: 1 product: 81 product_variation: 68 qsm_quiz: 1 revision: 2 schema: 4 shop_coupon: 286 shop_order: 167353 shop_order_refund: 2287 wafs: 1 was: 15 wll_records: 1708 wp-rest-api-log: 2315 wpcf7_contact_form: 2 wpsl_stores: 71 ywrfd-discount: 1 ### Security ### Secure connection (HTTPS): ? Hide errors from visitors: ? ### Active Plugins (36) ### Query Monitor: von John Blackbourn – 3.13.1 Advanced Custom Fields PRO: von WP Engine – 6.2.1.1 FiboSearch - AJAX Search for WooCommerce (Pro): von FiboSearch Team – 1.25.0 Cache Enabler: von KeyCDN – 1.8.13 Complianz | GDPR/CCPA Cookie Consent: von Really Simple Plugins – 6.5.5 Contact Form 7: von Takayuki Miyoshi – 5.8.1 Customer Reviews for WooCommerce: von CusRev – 5.36.3 GTM4WP: von Thomas Geiger – 1.18.1 Fluent Query Logger: von techjewel – 1.0.0 GP Premium: von Tom Usborne – 2.3.2 Rechtstexte-Schnittstelle der IT-Recht Kanzlei: von IT-Recht Kanzlei – 1.0.6 Min and Max Quantity for WooCommerce: von BeRocket – 1.3.3 Newsletter: von Stefano Lissa & Das Newsletter Team – 7.9.9 Payment Plugins for PayPal WooCommerce: von Payment Plugins [email protected] – 1.0.39 Redirection: von John Godley – 5.3.10 WooCommerce Show Single Variations by Iconic: von Iconic – 1.15.2 Side Cart WooCommerce: von XootiX – 2.4.4 Survey Maker: von Survey Maker team – 3.7.9 Advanced Editor Tools: von Automattic – 5.9.2 vendidero Helper: von vendidero – 2.2.1 Woo Discount Rules: von Flycart – 2.6.2 WooCommerce Permalink Manager (Premium): von premmerce – 2.0.1 Product Feed PRO for WooCommerce: von AdTribes.io – 13.0.4 Payment Plugins for Stripe WooCommerce: von Payment Plugins [email protected] – 3.3.50 WooCommerce Advanced Shipping: von Jeroen Sormani – 1.0.14 WooCommerce Color or Image Variation Swatches: von sysbasics – 3.8.3 WooCommerce Amazon Pay: von WooCommerce – 2.5.0 Germanized für WooCommerce Pro: von vendidero – 3.7.3 Germanized für WooCommerce: von vendidero – 3.13.5 WooCommerce Product Dependencies: von SomewhereWarm – 1.2.8 WooCommerce Price Based on Country: von Oscar Gare – 3.3.0 Sofort Banking for WooCommerce: von Sven Wagener – 1.5.1 WooCommerce Sponsor a Friend Plugin: von MB Création – 2.3.2 WooCommerce: von Automattic – 8.2.0 Yoast SEO: von Team Yoast – 21.3 WP Store Locator: von Tijmen Smit – 2.2.241 ### Inactive Plugins (6) ### Email Log: von Sudar – 2.4.8 heidelpay WooCommerce: von heidelpay – 1.6.0 Invisible reCaptcha: von Mihai Chelaru – 1.2.3 Nelio A/B Testing: von Nelio Software – 6.0.9 WooSwatches Mod - Woocommerce Color or Image Variation Swatches: von woomatrix – 2.8.5 (Pixelpulli Mod) WP Rocket: von WP Media – 3.15.2 ### Dropin Plugins (2) ### advanced-cache.php: advanced-cache.php db.php: Query Monitor Database Class (Drop-in) ### 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-filtered (exclude-from-filtered) 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) Connected to WooCommerce.com: ? Enforce Approved Product Download Directories: – HPOS feature screen enabled: – HPOS feature enabled: – Order datastore: WC_Order_Data_Store_CPT HPOS data sync enabled: – ### WC Pages ### Shop-Basis: #503048 - /alle-ago-produkte/ Warenkorb: #72 - /warenkorb/ Kasse: #12 - /kasse/ Mein Konto: #70 - /mein-konto/ Allgemeine Gesch?ftsbedingungen: #688 - /allgemeine_geschaeftsbedingungen/ ### Theme ### Name: GeneratePress Child Theme Version: 1.0 Author URL: https://my-blog-shop.de Child Theme: ? Parent Theme Name: GeneratePress Parent Theme Version: 3.3.1 Parent Theme Author URL: https://tomusborne.com WooCommerce Support: ? ### Templates ### Overrides: generatepress_child/woocommerce/cart/cart.php generatepress_child/woocommerce/emails/customer-note.php generatepress_child/woocommerce/emails/customer-processing-order.php generatepress_child/woocommerce/single-product/add-to-cart/variation.php ### Geolocation debug info ### Default customer location: geolocation MaxMind GeoIP database: ? MaxMind GeoIP license: ? MM_COUNTRY_CODE: ? GEOIP_COUNTRY_CODE: ? HTTP_CF_IPCOUNTRY: ? HTTP_X_COUNTRY_CODE: ? HTTP_X_REAL_IP: ? HTTP_X_FORWARDED_FOR: ? REMOTE_ADDR: 46.223.162.111 Real external IP: 2a02:8071:3e82:9580:4412:29d6:a5c1:5813 WCPBC_USE_REMOTE_ADDR: – Geolocation Test: ? ### PBC Settings ### Version: 3.3.0 Base location: DE:DE-NW Base currency: EUR Price Based On: shipping Shipping: – Test mode: – Test country: – Load products price in background: – Prices entered with tax: ? Calculate tax based on: shipping Display prices in the shop: incl ### Zone Pricing Drittl?nder ### zone_id: drittlaender enabled: yes name: Drittl?nder countries: CH currency: EUR exchange_rate: 0.840336134454 auto_exchange_rate: no disable_tax_adjustment: no order: 9999 ### Admin ### Enabled Features: activity-panels analytics product-block-editor coupons core-profiler customer-effort-score-tracks import-products-task experimental-fashion-sample-products shipping-smart-defaults shipping-setting-tour homescreen marketing mobile-app-banner navigation onboarding onboarding-tasks product-variation-management remote-inbox-notifications remote-free-extensions payment-gateway-suggestions shipping-label-banner subscriptions store-alerts transient-notices woo-mobile-welcome wc-pay-promotion wc-pay-welcome-page Disabled Features: customize-store minified-js new-product-management-experience settings async-product-editor-category-field Daily Cron: ? Next scheduled: 2023-10-12 10:42:20 +02:00 Options: ? Notes: 17 Onboarding: completed ### Action Scheduler ### Abgeschlossen: 10.292 Oldest: 2023-09-11 07:01:39 +0000 Newest: 2023-10-12 06:59:48 +0000 Fehlgeschlagen: 861 Oldest: 2022-04-02 12:42:30 +0000 Newest: 2023-10-11 11:15:14 +0000 Ausstehend: 6 Oldest: 2023-10-12 08:09:18 +0000 Newest: 2023-10-13 05:38:36 +0000 ### Status report information ### Generated at: 2023-10-12 09:01:17 +02:00
I’ve just found out that “wp_remote_get()” failed, but is ok on the test site. What does it mean? This is the same server with an identical configuration.
Quick update: It seems that the wc_customer_bought_product() function is not called on the working site clone. What’s going on here? Both sites should be working exactly the same.
- This reply was modified 1 year, 1 month ago by cutu234.
Loading the product page took almost 45 seconds. After logging out load time is 2 seconds or so.
Hello @cutu234,
Thank you for reaching out!I’ve just found out that “wp_remote_get()” failed, but is ok on the test site. What does it mean? This is the same server with an identical configuration.
You can ask your hosting provider to help you with this part. :?)
Quick update: It seems that the wc_customer_bought_product() function is not called on the working site clone. What’s going on here? Both sites should be working exactly the same.
The team is already aware of this performance issue, but it shouldn’t take 45 seconds, please check this report for more context: https://github.com/woocommerce/woocommerce/issues/34358
I know this doesn’t happen in the cloned environment, but could you please try performing a conflict test? Perhaps your theme or another plugin is overriding one of these methods:
Link to image: https://d.pr/i/n3Q3IULet us know how it goes!
You can ask your hosting provider to help you with this part. :?)
I did, of course, and my hosting company usually provides great support. They have no idea what that means and told me to contact the manufacturer (of the plugin). That’s funny, isn’t it?
Of course, I already did a conflict test. Couldn’t find any.
The only pattern I can see is that this database query run by the function wc_customer_bought_product() does not show, if loading time is ok. Again, it DOES NOT SHOW at all. Why is that? Why would this database query sometimes run and sometimes not, if everything else is exactly the same?
Can I somehow disable this function for test purposes? As far as I can see this query checks if a user (by email or ID or both) has bought an item. Why running this query on a product page?
Thank you!
I can confirm that removing the function from the core does fix the issue. This is, of course, not an option. It makes sense that this query takes some time, since the database table has around 3 millions rows. However, it should not take THAT long. And why would this function called on the product page?
I searched where the function wc_customer_bought_product() is used. I found it in /templates/single-product-reviews.php and had high hopes that I could change the template to fix the problem. No luck. Even if I remove the function from the template, page load time does not change at all. Removing the functions from /includes/wc-user-functions.php, on the other hand, does the trick.
It would be great to get some help on how to disable the function without modifying the core file.
Hello @cutu234
The function
wc_customer_bought_product()
is used to check if a customer has purchased a product before. This is useful in several scenarios, like showing a “Purchased” badge on products or limiting reviews only to customers who bought the product. Hence, it’s called on the product page.If you’re experiencing issues with it, you can disable it for testing purposes. However, you should never modify the core files, which can lead to potential issues and conflicts. Instead, you can use a hook to unhook this function.
remove_action( 'woocommerce_after_single_product_summary', 'wc_customer_bought_product', 10, 1 );
This should unhook the
wc_customer_bought_product()
function from thewoocommerce_after_single_product_summary
hook, effectively disabling it.Please let us know if this helps or if you need further assistance.
Hi there,
I was so happy to see your post, but unfortunately, it doesn’t work. I’ve just tried it in a clean browser (no cache, no history). The code snippet does not change anything. See this screenshot some minutes ago (timezone is Germany):
Removing the function from the core file immediately fixes the problem. I know that this is not an acceptable solution. But 50 seconds page load time on a product page is commercial suicide.
I’m pulling my hair out. I have NEVER EVER had such a nasty problem.
Please note that this is a 3 GB database with millions on entries in the postmeta table. You will not have any problems in a test installation.
I know that Woocommerce scales up poorly. I can live with that in the dashboard, but not on the frontend. And since I don’t use any feature that would need this function, why is it enabled anyway? There is something seriously wrong. Even if I remove this part from the single product template, the function is still running in the background. It drives me literally crazy.
Hello @cutu234,
It looks like the issue you’re facing is more complex than initially thought.
One possible reason the function might still be running could be due to it being hooked elsewhere in your theme or plugins. To investigate this, you could try disabling all other plugins and switching to a default theme like Storefront. If the issue persists, then it might be related to the size of your database.
With an extensive database like yours, certain WooCommerce functions can indeed slow down. You could consider optimizing your database, perhaps by cleaning up old order data or using a tool like WP-Optimize. You can also enable the High-Performance Order Storage (HPOS) option following our detailed guide here: https://woo.com/document/high-performance-order-storage/
However, since modifying WooCommerce core files is not recommended, you might need to develop a custom solution. This could involve creating a custom function to replace the
wc_customer_bought_product()
function that would be more optimized for your extensive database.Please note that custom coding is not something we can assist with directly. I would recommend hiring a developer or reaching out to a WooCommerce expert for this task. You could also ask development questions on the #developers channel of the WooCommerce Community Slack. Many of our developers hang out there and will be able to offer insights into your question.
I wish I could help more, but hopefully, this gets you going in the right direction to get the job done.
Hello,
We are having the same problem, just with lower load times, like 15-20s on product pages and only when we are logged in as administrator. Our database is even bigger, 4gb and 4 mil rows.
The thing is that this problem is kind of new, we didnot have it a few months ago and the database was the same size then.
So if anywone has any ideea how to solve this, thank you in advance!
The thing is that this problem is kind of new, we didnot have it a few months ago and the database was the same size then.
I can confirm that. Same here in our shop.
Could you post a list of your plugins? Maybe, we can find a pattern.
Does the problem occur with all other plugins disabled? For us, troubleshooting was insanely tedious. The problem does not always occur even in a 100% clone of the live website.
In our case, the problem occurs for all users, not only for logged in admins. It is so severe that we even got emails from customers complaining about page loading time.
Can you check whether removing the function from the core file fixes the issue?
- This reply was modified 1 year ago by cutu234.
Here’s a workaround on Github that fixed our problem. We disabled purchase verification for product reviews. That’s an acceptable workaround for us, since we approve all reviews manually. However, this might not be a solution for other users.
Oh my god, this really worked. We checked with some plugins disabled but nothing worked. The thing is that we have some option in the theme settings for trusted visitors (we disabled that beacause we had high load times for product with many reviews) and we also have some 3rd party module that colects review independently – CUSREV (we also disabled a lot of options from there with no luck).
- The topic ‘wc_customer_bought_product() slows down page massively’ is closed to new replies.