R Poole
R Poole

Reputation: 33

Bulk change the order status based on a date in Woocommerce

The following sql query will change order status:

update wp_posts set post_status = 'wc-completed' where post_type = 'shop_order' and post_status ='wc-processing' ;

How can I change the order status only on orders that are before a certain date?

Upvotes: 2

Views: 2639

Answers (1)

LoicTheAztec
LoicTheAztec

Reputation: 253968

To bulk change the order status before a date (for example before the 05 OCT 2018) using this SQL query (making always a database backup before):

UPDATE `wp_posts` 
SET `post_status` = 'wc-completed' 
WHERE `post_type` = 'shop_order' 
AND `post_status` ='wc-processing' 
AND `post_date` < '2018-10-05 00:00:00';

Tested and works

Upvotes: 2

Related Questions