Saturday, June 1, 2019

Woocommerce WordPress database error Table 'meveekay_****.wp_wc_product_meta_lookup' doesn't exist for query...

I had the following issue on my Wordpress/Woocommerce website:

Woocommerce WordPress database error Table 'meveekay_****.wp_wc_product_meta_lookup' doesn't exist for query...


Error Log:
[10-May-2019 17:21:18 UTC] WordPress database error Table 'meveekay_***.wp_wc_product_meta_lookup' doesn't exist for query SHOW FULL COLUMNS FROM `wp_wc_product_meta_lookup` made by require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('wp_loaded'), WP_Hook->do_action, WP_Hook->apply_filters, WC_Form_Handler::checkout_action, WC_Checkout->process_checkout, WC_Checkout->process_order_payment, WC_Gateway_Cheque->process_payment, WC_Order->update_status, WC_Order->save, WC_Order->status_transition, do_action('woocommerce_order_status_on-hold'), WP_Hook->do_action, WP_Hook->apply_filters, wc_update_total_sales_counts, WC_Data_Store->__call, WC_Product_Data_Store_CPT->update_product_sales, WC_Data_Store_WP->update_lookup_table



[11-May-2019 15:46:03 UTC] WordPress database error Table 'meveekay_***.wp_wc_product_meta_lookup' doesn't exist for query SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  LEFT JOIN wp_wc_product_meta_lookup wc_product_meta_lookup ON wp_posts.ID = wc_product_meta_lookup.product_id  WHERE 1=1  AND ( 
  wp_posts.ID NOT IN (
SELECT object_id
FROM wp_term_relationships
WHERE term_taxonomy_id IN (7)
)
) AND wp_posts.post_type = 'product' AND (wp_posts.post_status = 'publish') GROUP BY wp_posts.ID ORDER BY  wc_product_meta_lookup.total_sales DESC, wc_product_meta_lookup.product_id DESC  LIMIT 0, 16 made by require('wp-blog-header.php'), wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts


Issue Fix:


When I checked my database, table wp_wc_product_meta_lookup wasn't there, so created the table as:
CREATE TABLE wp_wc_product_meta_lookup( 
`product_id` bigint(20) NOT NULL,
`sku` varchar(100) NULL default '',
`virtual` tinyint(1) NULL default 0,
`downloadable` tinyint(1) NULL default 0,
`min_price` decimal(10,2) NULL default NULL,
`max_price` decimal(10,2) NULL default NULL,
`onsale` tinyint(1) NULL default 0,
`stock_quantity` double NULL default NULL,
`stock_status` varchar(100) NULL default 'instock',
`rating_count` bigint(20) NULL default 0,
`average_rating` decimal(3,2) NULL default 0.00,
`total_sales` bigint(20) NULL default 0
)

That fixed my problem!

This link might also be helpful:
https://woocommerce.wordpress.com/2019/04/01/performance-improvements-in-3-6/

1 comment: