SQL Error when saving variable products products
-
We are seeing this error in our logs every time we save a product with variations – we see it once per product variation X number of variable fields:
WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘) /* From [*****/wp-admin/post.php] in [/nas/content/live/******’ at line 1 for query INSERT INTO wp_braapf_product_variation_attributes (post_id, parent_id, meta_key, meta_value_id) VALUES(1543, 1511, ‘key-ring’, ) /* From [***.****.***/wp-admin/post.php] in [/***/****/***/********/wp-content/plugins/woocommerce-ajax-filters/addons/additional_tables/add_table.php:163]
Looking at that line we see the following:
$sql = “INSERT INTO {$wpdb->prefix}braapf_product_variation_attributes (post_id, parent_id, meta_key, meta_value_id) VALUES({$product_id}, {$parent_id}, ‘{$taxonomy}’, {$term->term_id})”;After looking at the error and confirming with our web host it appears no value is being passed in for meta_value_id, and since an integer is expected the call is failing.
We are running WordPress version 5.2.4 with WooCommerce Version 3.7.1 and the latest version 1.4.0.3 of this plugin.
Though this doesn’t seem to be impacting the functionality of the filters it is overwhelming our error logs on almost every product update and I am concerned that there are other impacts we haven’t picked up on.
- The topic ‘SQL Error when saving variable products products’ is closed to new replies.