Advertisement
Guest User

Untitled

a guest
Dec 18th, 2014
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.79 KB | None | 0 0
  1. /* 1. Update Pending Orders */
  2. UPDATE wp_posts as posts
  3. LEFT JOIN wp_term_relationships AS rel ON posts.ID = rel.object_ID
  4. LEFT JOIN wp_term_taxonomy AS tax USING( term_taxonomy_id )
  5. LEFT JOIN wp_terms AS term USING( term_id )
  6. SET posts.post_status = 'wc-pending'
  7. WHERE posts.post_type = 'shop_order'
  8. AND posts.post_status = 'publish'
  9. AND tax.taxonomy = 'shop_order_status'
  10. AND term.slug LIKE 'pending%';
  11.  
  12. /* 2. Update Processing Orders */
  13. UPDATE wp_posts as posts
  14. LEFT JOIN wp_term_relationships AS rel ON posts.ID = rel.object_ID
  15. LEFT JOIN wp_term_taxonomy AS tax USING( term_taxonomy_id )
  16. LEFT JOIN wp_terms AS term USING( term_id )
  17. SET posts.post_status = 'wc-processing'
  18. WHERE posts.post_type = 'shop_order'
  19. AND posts.post_status = 'publish'
  20. AND tax.taxonomy = 'shop_order_status'
  21. AND term.slug LIKE 'processing%';
  22.  
  23. /* 3. Update On-Hold Orders */
  24. UPDATE wp_posts as posts
  25. LEFT JOIN wp_term_relationships AS rel ON posts.ID = rel.object_ID
  26. LEFT JOIN wp_term_taxonomy AS tax USING( term_taxonomy_id )
  27. LEFT JOIN wp_terms AS term USING( term_id )
  28. SET posts.post_status = 'wc-on-hold'
  29. WHERE posts.post_type = 'shop_order'
  30. AND posts.post_status = 'publish'
  31. AND tax.taxonomy = 'shop_order_status'
  32. AND term.slug LIKE 'on-hold%';
  33.  
  34. /* 4. Update Completed Orders */
  35. UPDATE wp_posts as posts
  36. LEFT JOIN wp_term_relationships AS rel ON posts.ID = rel.object_ID
  37. LEFT JOIN wp_term_taxonomy AS tax USING( term_taxonomy_id )
  38. LEFT JOIN wp_terms AS term USING( term_id )
  39. SET posts.post_status = 'wc-completed'
  40. WHERE posts.post_type = 'shop_order'
  41. AND posts.post_status = 'publish'
  42. AND tax.taxonomy = 'shop_order_status'
  43. AND term.slug LIKE 'completed%';
  44.  
  45. /* 5. Update Cancelled Orders */
  46. UPDATE wp_posts as posts
  47. LEFT JOIN wp_term_relationships AS rel ON posts.ID = rel.object_ID
  48. LEFT JOIN wp_term_taxonomy AS tax USING( term_taxonomy_id )
  49. LEFT JOIN wp_terms AS term USING( term_id )
  50. SET posts.post_status = 'wc-cancelled'
  51. WHERE posts.post_type = 'shop_order'
  52. AND posts.post_status = 'publish'
  53. AND tax.taxonomy = 'shop_order_status'
  54. AND term.slug LIKE 'cancelled%';
  55.  
  56. /* 6. Update Refunded Orders */
  57. UPDATE wp_posts as posts
  58. LEFT JOIN wp_term_relationships AS rel ON posts.ID = rel.object_ID
  59. LEFT JOIN wp_term_taxonomy AS tax USING( term_taxonomy_id )
  60. LEFT JOIN wp_terms AS term USING( term_id )
  61. SET posts.post_status = 'wc-refunded'
  62. WHERE posts.post_type = 'shop_order'
  63. AND posts.post_status = 'publish'
  64. AND tax.taxonomy = 'shop_order_status'
  65. AND term.slug LIKE 'refunded%';
  66.  
  67. /* 7. Update Failed Orders */
  68. UPDATE wp_posts as posts
  69. LEFT JOIN wp_term_relationships AS rel ON posts.ID = rel.object_ID
  70. LEFT JOIN wp_term_taxonomy AS tax USING( term_taxonomy_id )
  71. LEFT JOIN wp_terms AS term USING( term_id )
  72. SET posts.post_status = 'wc-failed'
  73. WHERE posts.post_type = 'shop_order'
  74. AND posts.post_status = 'publish'
  75. AND tax.taxonomy = 'shop_order_status'
  76. AND term.slug LIKE 'failed%';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement