• Resolved khalil43

    (@khalil43)


    Hi, one of my customers did an order, i changed the order status from processing to completed, the customer did a copy of the link (/checkout/order-received/18111/?key=wc_order_e5RsdsVBD2tJY) and opened it later, the order status changed from completed to processing. how to prevent this issue ? thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Siew

    (@kosiew)

    Hi there,

    This is not the normal behavior.

    Do you have a plugin or customization that enables changing order status via links like you mentioned above?

    Thread Starter khalil43

    (@khalil43)

    i have this function :
    //Function allow edit completed orders

    add_filter( ‘wc_order_is_editable’, ‘wc_make_completed_orders_editable’, 10, 2 );
    function wc_make_completed_orders_editable( $is_editable, $order ) {
    if ( $order->get_status() == ‘completed’ ) {
    $is_editable = true;
    }

    return $is_editable;
    }

    and this function:

    // 1 New order status AFTER woo 2.2 Termine
    add_action( ‘init’, ‘register_my_new_order_statuses’ );
    function register_my_new_order_statuses() {
    register_post_status( ‘wc-termine’, array(
    ‘label’ => _x( ‘Payée’, ‘Order status’, ‘woocommerce’ ),
    ‘public’ => true,
    ‘exclude_from_search’ => false,
    ‘show_in_admin_all_list’ => true,
    ‘show_in_admin_status_list’ => true,
    ‘label_count’ => _n_noop( ‘Payée <span class=”count”>(%s)</span>’, ‘Payée <span class=”count”>(%s)</span>’, ‘woocommerce’ )
    ) );
    }
    add_filter( ‘wc_order_statuses’, ‘my_new_wc_order_statuses’ );
    // Register in wc_order_statuses.
    function my_new_wc_order_statuses( $order_statuses ) {
    $order_statuses[‘wc-termine’] = _x( ‘Payée’, ‘Order status’, ‘woocommerce’ );
    return $order_statuses;
    }

    /*
    * 2 CHANGE STATUSES ORDER IN DROPDOWN LIST
    * @param array $wc_statuses_arr Array of all order statuses on the website
    */
    function change_statuses_order( $wc_statuses_arr ){

    $new_statuses_arr = array(
    ‘wc-processing’ => $wc_statuses_arr[‘wc-processing’], // 1
    ‘wc-termine’ => $wc_statuses_arr[‘wc-termine’], // 2
    ‘wc-completed’ => $wc_statuses_arr[‘wc-completed’], // 3
    ‘wc-cancelled’ => $wc_statuses_arr[‘wc-cancelled’], // 4
    ‘wc-refunded’ => $wc_statuses_arr[‘wc-refunded’], // 5
    ‘wc-failed’ => $wc_statuses_arr[‘wc-failed’], // 6
    ‘wc-pending’ => $wc_statuses_arr[‘wc-pending’], // 7
    ‘wc-on-hold’ => $wc_statuses_arr[‘wc-on-hold’] // 8
    );

    return $new_statuses_arr;
    }

    add_filter( ‘wc_order_statuses’, ‘change_statuses_order’ );

    // 3. ADD COLOR TO IN PROGRESS BUTTON
    add_action(‘admin_head’, ‘styling_admin_order_list’ );
    function styling_admin_order_list() {
    global $pagenow, $post;

    if( $pagenow != ‘edit.php’) return; // Exit
    if( get_post_type($post->ID) != ‘shop_order’ ) return; // Exit

    // HERE below set your custom status
    $order_status = ‘Payée’; // <==== HERE
    ?>
    <style>
    .order-status.status-<?php echo sanitize_title( $order_status ); ?> {
    background: #0394fc;
    color: #ffffff;
    }
    </style>
    <?php
    }

    add_filter( ‘woocommerce_reports_order_statuses’, ‘include_custom_order_status_to_reports’, 20, 1 );
    function include_custom_order_status_to_reports( $statuses ){
    // Adding the custom order status to the 3 default woocommerce order statuses
    return array( ‘processing’, ‘termine’, ‘completed’, ‘on-hold’ );
    }

    Siew

    (@kosiew)

    Hi there,

    This forum is not the best place for coding specific help though.

    For this purpose, I highly recommend joining the WooCommerce Developers Slack community:
    https://woocommercecommunity.slack.com/

    If you don’t already have an account, you can sign up at the bottom of the following page:https://woocommerce.com/develop-woocommerce/

    Otherwise, if you need someone to code this for I would recommend checking somewhere like https://www.codeable.io for skilled third-party developers.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘order status is changin on its own’ is closed to new replies.