Broken orders: Product IDs missing from order items
-
We have had a problems with orders. Their order IDs seem to be missing.
On the order’s page, there is no product image and no link back to the product page. Affected orders cannot be sync’ed with our accounting system (we use an external service to accomplish this) because product IDs in the orders don’t match with product IDs in accounting.
While investigating this issue, we analyzed the database contents about affected orders. In DB table prefix_woocommerce_order_itemmeta, affected order items have a _product_id value of 0 instead of the product’s actual ID. It seems like WooCommerce does not save the product IDs to the database for some reason, only the order_item_name in table prefix_woocommerce_order_items.
We discovered a “quick” way of fixing affected order items: We just change _product_id in prefix_woocommerce_order_itemmeta to the actual product ID – as soon as it is corrected, WooCommerce order page shows product image and link to product page, and our external sync service is able to sync the order items.
We looked at all the usual data to find relevant information about this issue:
PHP logs, WC status page, WC logs, Site Health plugin, WP debug logs. There is nothing which matches the orders affected.We cannot reproduce the issue, though. Most of the orders come through just fine.
Does anyone have had this or something similar happening?
- The topic ‘Broken orders: Product IDs missing from order items’ is closed to new replies.