wc_update_220_order_status

The WooCommerce wc update 220 order status function.

Description

wc_update_220_order_status(); 

Usage

  1. if ( !function_exists( 'wc_update_220_order_status' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-update-functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wc_update_220_order_status(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/includes/wc-update-functions.php  
  1. function wc_update_220_order_status() { 
  2. global $wpdb; 
  3. $wpdb->query( " 
  4. UPDATE {$wpdb->posts} as posts 
  5. LEFT JOIN {$wpdb->term_relationships} AS rel ON posts.ID = rel.object_id 
  6. LEFT JOIN {$wpdb->term_taxonomy} AS tax USING( term_taxonomy_id ) 
  7. LEFT JOIN {$wpdb->terms} AS term USING( term_id ) 
  8. SET posts.post_status = 'wc-pending' 
  9. WHERE posts.post_type = 'shop_order' 
  10. AND posts.post_status = 'publish' 
  11. AND tax.taxonomy = 'shop_order_status' 
  12. AND term.slug LIKE 'pending%'; 
  13. ); 
  14. $wpdb->query( " 
  15. UPDATE {$wpdb->posts} as posts 
  16. LEFT JOIN {$wpdb->term_relationships} AS rel ON posts.ID = rel.object_id 
  17. LEFT JOIN {$wpdb->term_taxonomy} AS tax USING( term_taxonomy_id ) 
  18. LEFT JOIN {$wpdb->terms} AS term USING( term_id ) 
  19. SET posts.post_status = 'wc-processing' 
  20. WHERE posts.post_type = 'shop_order' 
  21. AND posts.post_status = 'publish' 
  22. AND tax.taxonomy = 'shop_order_status' 
  23. AND term.slug LIKE 'processing%'; 
  24. ); 
  25. $wpdb->query( " 
  26. UPDATE {$wpdb->posts} as posts 
  27. LEFT JOIN {$wpdb->term_relationships} AS rel ON posts.ID = rel.object_id 
  28. LEFT JOIN {$wpdb->term_taxonomy} AS tax USING( term_taxonomy_id ) 
  29. LEFT JOIN {$wpdb->terms} AS term USING( term_id ) 
  30. SET posts.post_status = 'wc-on-hold' 
  31. WHERE posts.post_type = 'shop_order' 
  32. AND posts.post_status = 'publish' 
  33. AND tax.taxonomy = 'shop_order_status' 
  34. AND term.slug LIKE 'on-hold%'; 
  35. ); 
  36. $wpdb->query( " 
  37. UPDATE {$wpdb->posts} as posts 
  38. LEFT JOIN {$wpdb->term_relationships} AS rel ON posts.ID = rel.object_id 
  39. LEFT JOIN {$wpdb->term_taxonomy} AS tax USING( term_taxonomy_id ) 
  40. LEFT JOIN {$wpdb->terms} AS term USING( term_id ) 
  41. SET posts.post_status = 'wc-completed' 
  42. WHERE posts.post_type = 'shop_order' 
  43. AND posts.post_status = 'publish' 
  44. AND tax.taxonomy = 'shop_order_status' 
  45. AND term.slug LIKE 'completed%'; 
  46. ); 
  47. $wpdb->query( " 
  48. UPDATE {$wpdb->posts} as posts 
  49. LEFT JOIN {$wpdb->term_relationships} AS rel ON posts.ID = rel.object_id 
  50. LEFT JOIN {$wpdb->term_taxonomy} AS tax USING( term_taxonomy_id ) 
  51. LEFT JOIN {$wpdb->terms} AS term USING( term_id ) 
  52. SET posts.post_status = 'wc-cancelled' 
  53. WHERE posts.post_type = 'shop_order' 
  54. AND posts.post_status = 'publish' 
  55. AND tax.taxonomy = 'shop_order_status' 
  56. AND term.slug LIKE 'cancelled%'; 
  57. ); 
  58. $wpdb->query( " 
  59. UPDATE {$wpdb->posts} as posts 
  60. LEFT JOIN {$wpdb->term_relationships} AS rel ON posts.ID = rel.object_id 
  61. LEFT JOIN {$wpdb->term_taxonomy} AS tax USING( term_taxonomy_id ) 
  62. LEFT JOIN {$wpdb->terms} AS term USING( term_id ) 
  63. SET posts.post_status = 'wc-refunded' 
  64. WHERE posts.post_type = 'shop_order' 
  65. AND posts.post_status = 'publish' 
  66. AND tax.taxonomy = 'shop_order_status' 
  67. AND term.slug LIKE 'refunded%'; 
  68. ); 
  69. $wpdb->query( " 
  70. UPDATE {$wpdb->posts} as posts 
  71. LEFT JOIN {$wpdb->term_relationships} AS rel ON posts.ID = rel.object_id 
  72. LEFT JOIN {$wpdb->term_taxonomy} AS tax USING( term_taxonomy_id ) 
  73. LEFT JOIN {$wpdb->terms} AS term USING( term_id ) 
  74. SET posts.post_status = 'wc-failed' 
  75. WHERE posts.post_type = 'shop_order' 
  76. AND posts.post_status = 'publish' 
  77. AND tax.taxonomy = 'shop_order_status' 
  78. AND term.slug LIKE 'failed%'; 
  79. );