Home Forums Plugins Store Exporter Deluxe Ideas Auto complete after export

Welcome to our community support forums! We're here to help - but if you have an urgent request for a Pro Plugin, you will get a prioritised response through our Premium Support page.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #50058
    Hendrik
    Participant

    Hey there,

    is there a way to set exported orders to complete?

    Thank you!

    #50059
    Hendrik
    Participant

    Okay, I build sometime that works. But I need a hook that runs best after the scheudle export has been send:

    add_action( ‘XXX_RIGHT_AFTER_SCHEDULED_EXPORT_XXX’, ‘auto_update_orders_status_from_processing_to_completed’);

    P.S.: If this can be simplifed, please let me know:

    /* ——— Enable Custom Variables in Query for orders ——– */
    function handle_custom_query_var( $query, $query_vars ) {
    if ( ! empty( $query_vars[‘_woo_cd_exported’] ) ) {
    $query[‘meta_query’][] = array(
    ‘key’ => ‘_woo_cd_exported’,
    ‘value’ => esc_attr( $query_vars[‘_woo_cd_exported’] ),
    );
    }

    return $query;
    }
    add_filter( ‘woocommerce_order_data_store_cpt_get_orders_query’, ‘handle_custom_query_var’, 10, 2 );

    /* ——– Get Orders ——- */
    function auto_update_orders_status_from_processing_to_completed(){
    // Get all current “processing” customer orders
    $processing_orders = wc_get_orders( $args = array(
    ‘post_status’ => ‘wc-processing’,
    ‘_woo_cd_exported’ => ‘1’,
    ) );
    if(!empty($processing_orders))
    foreach($processing_orders as $order)
    $order->update_status( ‘completed’, ‘By robot ‘ . date(“d.m.y h:i:s”));
    }

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Ideas’ is closed to new topics and replies.