Find WooCommerce Order Notes
February 21, 2025 ยท AI Conversations
### Steps to Find Manually Added Order Notes:
1. **Go to WooCommerce Admin**
– Log in to your WordPress admin panel.
– Navigate to **WooCommerce** > **Orders**.
2. **Open an Order**
– Click on the order you want to check.
3. **Locate the Order Notes Section**
– Scroll down to the **Order Notes** panel on the right side of the order details page.
4. **Identify Manually Added Notes**
– WooCommerce differentiates notes by color:
– **Manually added notes** (by admin) are in white or light gray.
– **Automated system notes** (by WooCommerce) are in a darker gray.
– **Customer notes** (sent to the customer) are in purple.
5. **Filter or Add a New Note** (Optional)
– You can manually add a new note by entering text in the "Add note" field and selecting whether it should be a **private note** or a **customer note**.
Would you like to programmatically retrieve these notes or display them differently in your WooCommerce admin?
### **SQL Query to Find Manually Added Order Notes**
SELECT comment_ID, comment_post_ID, comment_author, comment_date, comment_content
FROM wp_comments
WHERE comment_type = 'order_note'
AND comment_author != 'WooCommerce'
ORDER BY comment_date DESC;
### **Explanation:**
– `comment_type = 'order_note'` โ Filters order notes.
– `comment_author != 'WooCommerce'` โ Excludes system-generated notes.
– `ORDER BY comment_date DESC` โ Shows the most recent notes first.
### **If You Want Notes for a Specific Order ID**
Replace `ORDER_ID` with the actual order ID:
SELECT comment_ID, comment_post_ID, comment_author, comment_date, comment_content
FROM wp_comments
WHERE comment_type = 'order_note'
AND comment_author != 'WooCommerce'
AND comment_post_ID = ORDER_ID
ORDER BY comment_date DESC;
### **If Your Table Prefix is Different**
Replace `wp_` with your actual table prefix (e.g., `wp123_`).
Do you need help running this query or integrating it into your WooCommerce admin? ๐
I want manually added notes
### **Optimized SQL Query:**
SELECT comment_ID, comment_post_ID, comment_author, comment_date, comment_content
FROM wp_comments
WHERE comment_type = 'order_note'
AND comment_author NOT IN ('WooCommerce', 'WordPress')
ORDER BY comment_date DESC;
### **Why This Works:**
– **`comment_type = 'order_note'`** โ Ensures we are fetching only order notes.
– **`comment_author NOT IN ('WooCommerce', 'WordPress')`** โ Excludes system-generated notes (e.g., status changes).
– **Manually added notes** are typically created by an admin user and will have the `comment_author` field set to the actual admin username.
### **Find Manually Added Notes for a Specific Order:**
SELECT comment_ID, comment_post_ID, comment_author, comment_date, comment_content
FROM wp_comments
WHERE comment_type = 'order_note'
AND comment_author NOT IN ('WooCommerce', 'WordPress')
AND comment_post_ID = ORDER_ID
ORDER BY comment_date DESC;
Replace `ORDER_ID` with the actual order ID.
### **Alternative Approach: Checking Manually Added Notes**
Since WooCommerce does not explicitly mark notes as "manual," another way is to exclude notes that contain common system-generated phrases like:
SELECT comment_ID, comment_post_ID, comment_author, comment_date, comment_content
FROM wp_comments
WHERE comment_type = 'order_note'
AND comment_author NOT IN ('WooCommerce', 'WordPress')
AND comment_content NOT LIKE '%status changed%'
AND comment_content NOT LIKE '%Order refunded%'
AND comment_content NOT LIKE '%Stock level reduced%'
ORDER BY comment_date DESC;
This filters out notes related to status changes, refunds, and stock adjustments.
Let me know if you need further refinements! ๐