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
Related
I have imported a ton of products, but I need to go through and edit every title for conciseness. I went into the database in phpMyAdmin, but can't seem to locate the titles.
I looked under wp_posts > indexes, but can't quite figure it out.
I want to basically bring up all titles in a big list in phpmyadmin and go through editing them one by one.
I'm not familiar with WooCommerce but from a looking at their documentation, products are stored as product post type. This means you can run an SQL query in phpMyAdmin to only show posts matching that post type.
SELECT post_title FROM wp_posts WHERE post_type = 'product'
The above query will return all posts matching the product post type but only return the post_title (a.k.a the product title).
If you want to show all fields run the following.
SELECT * FROM wp_posts WHERE post_type = 'product'
Back up your database before doing anything, just incase!
I want to retrieve catalog/products sorting configured from Admin into my theme. Is there a way to do that?
WooCommerce stores the default sorting configuration in the wp_options table, so you can retrieve it with:
get_option('woocommerce_default_catalog_orderby');
It will return only the current configured sorting criteria.
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.
Hello i have a online shop using Wordpress and Woocommerce but i have the following problem. I need to change all of my 2000 products to be out of stock, i haven't selected any quantity i only need to change the status. I started doing it by hand but it will take quite a while to mark all the items. After browsing the net i saw that this can be done relatively easy in phpmyadmin, the status is stored in wp_postmeta, i myself tried fiddling with the queries of phpmyadmin but to no avail . Can someone help me with building the query that i need to use ? I use WP 4.1.1
ok bro write this query in your db
Update wp_postmeta Set meta_value = 'outofstock' Where meta_value = 'instock' And meta_key = '_stock_status'
I restricted update query more by using And meta_key = '_stock_status'
Hope this will help you ... don't worry query is completely right but you must take a DB backup