Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function example_wpf_wpe_issue() {
- $args = array(
- 'numberposts' => - 1,
- 'post_type' => 'shop_order',
- 'post_status' => array( 'wc-processing', 'wc-completed' ),
- 'fields' => 'ids',
- 'meta_query' => array(
- array(
- 'key' => 'wpf_complete',
- 'compare' => 'NOT EXISTS',
- ),
- ),
- );
- $orders = get_posts( $args );
- // NOTE: the results of this query are being cached
- foreach ( $orders as $order_id ) {
- $complete = get_post_meta( $order_id, 'wpf_complete', true );
- // NOTE: the result of this call to get_post_meta is being cached
- if ( ! empty( $complete ) ) {
- return;
- }
- //
- // API CALLS TO DRIP ARE SENT HERE
- //
- update_post_meta( $order_id, 'wpf_complete', true );
- $order = wc_get_order( $order_id );
- $order->add_order_note( 'WP Fusion order actions completed.' );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement