【问题标题】:Bulk change the order status based on a date in Woocommerce根据 Woocommerce 中的日期批量更改订单状态
【发布时间】:2019-04-24 07:27:07
【问题描述】:

以下sql查询会改变订单状态:

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

如何仅更改特定日期之前的订单状态?

【问题讨论】:

    标签: mysql sql wordpress woocommerce orders


    【解决方案1】:

    要在日期之前批量更改订单状态(例如在05 OCT 2018 之前)使用此 SQL 查询(之前总是备份数据库): p>

    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';
    

    经过测试并且可以工作

    【讨论】:

    • 哇哦! 24739 行受到影响。 (查询耗时 0.6414 秒。)非常好,谢谢。
    猜你喜欢
    • 2018-01-01
    • 2022-10-05
    • 1970-01-01
    • 2021-04-08
    • 1970-01-01
    • 2017-05-24
    • 2019-08-23
    • 2018-04-27
    • 1970-01-01
    相关资源
    最近更新 更多