• Resolved frischi

    (@frischi)


    HI, thanks for this nice plugin. How can I prevent the order status from changing to “completed” when the tracking information is automatically transferred via cj dropshipping’s rest api? I would like the tracking information to be entered automatically. But not that the status automatically goes to “completed”, and therefore the email with the tracking information is also sent automatically. I would like to set the status to completed only after the tracking information has been updated manually.

    Is it possible to delete the “completed” Email in the “Order emails display” settings ? Because if I click on it, nothing happens.

    • This topic was modified 8 months, 2 weeks ago by frischi.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author gaurav1092

    (@gaurav1092)

    Hi @frischi,

    To address your first question, you’ll need to contact CJ Dropshipping and request that they modify their REST API to include the parameter “status_shipped” with a value of 0. This will prevent the order status from automatically changing to “completed” when tracking information is transferred via their API. For more details on how to implement this, you can refer to our Shipment Tracking API documentation here: https://docs.zorem.com/docs/ast-free/add-tracking-to-orders/shipment-tracking-api.

    Regarding your second question, unfortunately, it is not currently possible to delete the “completed” email in the “Order emails display” settings.

    Best Regards,
    Gaurav

    Thread Starter frischi

    (@frischi)

    Ok, thanks. Is it also possible to use an action or filter hook in my wordpress to override this property? Then I would do that.

    Plugin Author gaurav1092

    (@gaurav1092)

    You can use the ast_api_create_item_arg filter to modify the arguments passed when creating a shipment tracking item via the API. Here’s a code snippet demonstrating how you can override the status_shipped parameter to set it to 1:

    add_filter( 'ast_api_create_item_arg', 'customize_shipment_tracking_args', 10, 2 );
    
    function customize_shipment_tracking_args( $args, $request ) {
        // Change the status_shipped parameter to 1
        $args['status_shipped'] = 1;
        
        // Return the modified arguments
        return $args;
    }
    

    You can add this code snippet to your theme’s functions.php file or a custom plugin. With this filter in place, any tracking items created via the API will have the status_shipped parameter set to 1, ensuring that the order status does not automatically change to “completed”.

    Best Regards,
    Gaurav

    Thread Starter frischi

    (@frischi)

    Thanks. This looks very nice. I will try that.

    Thread Starter frischi

    (@frischi)

    Sorry, but it is confusing. Does the $args[‘status_shipped’] value really has to be set to 1? Is it not 0 for preventing order status automatically change to “completed”?

    Plugin Author gaurav1092

    (@gaurav1092)

    Yes, you are correct. To prevent the order status from automatically changing to “completed,” you need to set the value of $args['status_shipped'] to 0, not 1. This ensures that the order remains in its current status and does not transition to “completed” when updating the tracking information.

    Thread Starter frischi

    (@frischi)

    ok, thanks. =)

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘No auto status on insert tracking number via rest api’ is closed to new replies.