0

I am trying to add a button which depends on the order status, will let the shop owner to change to next order status according to a flowchart I have planned.

I wrote the code and all status change buttons works but the button which changes to on-hold.

This is the code:

if ( in_array( dokan_get_prop( $the_order, 'status' ), array( 'pending' ) ) ) {
    $actions['on-hold'] = array(
        'url' => wp_nonce_url( admin_url( 'admin-ajax.php?action=dokan-mark-order-on-hold&order_id=' . dokan_get_prop( $the_order, 'id' ) ), 'dokan-mark-order-on-hold' ),
        'name' => __( 'On Hold', 'dokan-lite' ),
        'action' => "on-hold",
        'icon' => '<i class="fa fa-clock-o">&nbsp;</i>'
    );
}

if ( in_array( dokan_get_prop( $the_order, 'status' ), array( 'on-hold' ) ) ) {
    $actions['processing'] = array(
        'url' => wp_nonce_url( admin_url( 'admin-ajax.php?action=dokan-mark-order-processing&order_id=' . dokan_get_prop( $the_order, 'id' ) ), 'dokan-mark-order-processing' ),
        'name' => __( 'Processing', 'dokan-lite' ),
        'action' => "processing",
        'icon' => '<i class="fa fa-clock-o">&nbsp;</i>'
    );
}

if ( in_array( dokan_get_prop( $the_order, 'status' ), array( 'processing' ) ) ) {
    $actions['complete'] = array(
        'url' => wp_nonce_url( admin_url( 'admin-ajax.php?action=dokan-mark-order-complete&order_id=' . dokan_get_prop( $the_order, 'id' ) ), 'dokan-mark-order-complete' ),
        'name' => __( 'Complete', 'dokan-lite' ),
        'action' => "complete",
        'icon' => '<i class="fa fa-check">&nbsp;</i>'
    );
}

Any ideas?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.