I am trying to find a way to export all of my orders from woocommerce to extract the emails of all customers, or just extract the emails.
I tried the following plugin that exports the users, but it seems wordpress only allows 2000 users max?
It says premium will allow customers as well as users.
https://wordpress.org/plugins/users-customers-import-export-for-wp-woocommerce/
I use the following SQL command to extract all the emails from the orders. Users don't need to have an account, it's pulled from the orders.
SELECT meta_value FROM `wp_postmeta` WHERE meta_key = '_billing_email'
Related
I have used NS Cloner to clone site within WooCommerce. This has worked extremely well but the existing orders have been duplicated in the cloned site; I obviously would like remove all of these. In total there are 17,000 or more that I need to remove so doing this in the Admin area isn't an option as it does in 20 batches. There isn't an option to do a bulk delete. I have a suspicion I make have to do this at a mysql level. There is a plugin out there (WC Delete All Orders) but the reviews are less than favourable.
Could some one point me in the right direction please?
You can use this plugin in order to delete in bulk
https://wordpress.org/plugins/woocommerce-store-toolkit
So I used SQL query for this one:
UPDATE wp_posts SET post_status = 'trash' WHERE post_type = 'shop_order';
from this link - how to delete completed orders in woocommerce using a my sql query
I had a failed customer/order import when I upgraded a WooCommerce site.
Customers are now logging in and seeing orders and customer information for random orders - not their own. It is a catastrophe!
I am thinking that a solution might be to unlink all customers from orders and forcing customers to be manually relinked on request.
Problem is - I have an unverified problem whereby one customer recreated a user and on login, had been "magically" linked to another customers order details - so even creating new users seems to be problematic.
Any suggestions would be helpful.
This is a possible explanation of your problem. The customer for an order is saved in the the wp_postmeta table with the meta_key '_customer_user'. This integer is a reference to 'ID' column of wp_users. I think your import broke this relationship. Did your import change user id's? If so you need to remap all the '_customer_user' meta_values to their corresponding new user ids.
If you want to just unlink orders from customers I would try setting this field to 0 or maybe to 1 which would mean that initial user (sysadmin) would now be the customer for all orders. If you do this remember to keep a record of the original '_customer_user' so you can try and recover the correct id later.
I currently have 40,000 products in my woocommerce store which are published. Is there a way to mark all products of particular categories as a draft without manually changing them to draft via bulk edit, as I can only modify 200-300 before I get a timeout error. I dont want to delete any product.
The easiest option is to run a direct SQL query. The following will work
UPDATE wp_posts p
JOIN wp_term_relationships r on p.id=r.object_id
SET p.post_status='draft'
WHERE r.term_taxonomy_id in (123, 456);
Replace 123, 456 with the relevant term ids.
Ensure to take a backup of the database before proceeding.
No sooner is my website fully functional that it gets hacked. If you do a Google search with the link below, the results show spam keywords in the pages throughout such as "casino", "blackjack", "slot", "deposit", etc. But if I look through the pages, I don't see any of the spam.
Here is the Google search result:
https://www.google.ca/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=site%3Arichardrosenman.com%20richard%20rosenman
I am not very advanced with Wordpress or PHP and I have tried searching. Can anyone help me figure out where it was hacked and how I can clean and protect it?
Since 'social.png' is included and there are spam keywords you probably are experiencing a CryptoPHP hack. There's much to find about it (in combination with Wordpress) and, fortunately, how to clear it.
Same happend with one of my client, he has only 15 posts in backend but google shows some wierd keywords and post which is crawed. To check this kind of posts/pages you have to look in the database. wp_posts table holds all the custom post types, pages etc, and display only the post that has publish status in post_status section.
To retrive all the published pages or post use the following query.
// will display all posts/pages etc.
SELECT * FROM `wp_posts` WHERE `post_status` = "publish"
// Display only Pages
SELECT * FROM `wp_posts` WHERE `post_status` = "publish" and `post_type` = "page"
// Display only posts
SELECT * FROM `wp_posts` WHERE `post_status` = "publish" and `post_type` = "post"
Now you know how to filter data, every record from this filtered data has a column post_author that holds the ID of the user that published that post/page.
Go to the wp_users table and check your user_login name and get the ID of your administrator account. And again filter the run a query in wp_posts table to filter the anonymous users data.
// Make sure you have only one administrator, replace 1 with your user id
SELECT * FROM `wp_posts` WHERE `post_author` not in (1)
// If you have multiple administrator then use the following, replace 1,5,6 with admin ID's
SELECT * FROM `wp_posts` WHERE `post_author` not in (1,5,6)
And final step is to delete that.
Important: Before Apply this action make sure to take backup first, so just in case you can retrive that data later.
Hope this help you.
Two questions involved in my quagmire:
Where do I find 'report functionality' in the woo themes plugins?
How do I implement reporting for a custom user role in the orders section (the custom user role has already been created in WP?
Example:
sales by date | sales by product | sales by 'custom user role here'
Solution for Query 1:
The report functionality can be assessed from front-end via WooCommerce->Reports as shown in the following image
The backend of this functionality comes from the Package WooCommerce/Admin/Reports i.e. within the file structure of
/woocommerce/includes/admin/reports/
Solution for Query 2:
WooCommerce doesn't provide "sales by 'custom user role here'" by deafult but you can code so or you can use Woocommerce Order Report Snapshot plugin to get roles specific reports