• Resolved Maximus697

    (@maximus697)


    Hi,

    I try to get the order list with a custom status but with the REST API V3 it finds me nothing and with the V2 I have oders but also orders with status completed .. And when I try to make a update commands with the REST API on a custom status it puts me the status pending .. do you know why?

    Thx

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Maximus697

    (@maximus697)

    It works, we had to add the filter

    add_filter(‘wc_order_statuses’, ‘wc_order_statuses_custom’);

    Hi @maximus697

    Thank you for sharing the solution with us and with other customers.

    I am glad to know that you have found a solution which works in order to achieve your requirements.

    Please let us know if you have any further queries.

    Regards,
    Komal Maru

    Thread Starter Maximus697

    (@maximus697)

    Hi,

    The complete solution is:

    add_filter(‘wc_order_statuses’, ‘wc_order_statuses_custom’);
    function wc_order_statuses_custom($order_statuses) {
    $order_statuses[‘wc-processing-cec’] = _x( ‘En attente d\’expédition’, ‘Order status’, ‘woocommerce’ );
    $order_statuses[‘wc-despatched’] = _x( ‘Expédié’, ‘Order status’, ‘woocommerce’ );
    $order_statuses[‘wc-in_preparation’] = _x( ‘Prise en charge par cec’, ‘Order status’, ‘woocommerce’ );
    $order_statuses[‘wc-failed-cec’] = _x( ‘Erreur logisitque CEC’, ‘Order status’, ‘woocommerce’ );

    return $order_statuses;
    }

    function custom_post_status(){
    register_post_status( ‘wc-processing-cec’, array(
    ‘label’ => _x( ‘Processing CEC’, ‘recipes’ ),
    ‘public’ => false,
    ‘exclude_from_search’ => true,
    ‘show_in_admin_all_list’ => true,
    ‘show_in_admin_status_list’ => true,
    ‘label_count’ => _n_noop( ‘Processing CEC <span class=”count”>(%s)</span>’, ‘Processing CEC <span class=”count”>(%s)</span>’ ),
    ) );

    register_post_status( ‘wc-despatched’, array(
    ‘label’ => _x( ‘Despatched CEC’, ‘recipes’ ),
    ‘public’ => false,
    ‘exclude_from_search’ => true,
    ‘show_in_admin_all_list’ => true,
    ‘show_in_admin_status_list’ => true,
    ‘label_count’ => _n_noop( ‘Despatched CEC <span class=”count”>(%s)</span>’, ‘Despatched CEC <span class=”count”>(%s)</span>’ ),
    ) );

    register_post_status( ‘wc-in_preparation’, array(
    ‘label’ => _x( ‘In preparation CEC’, ‘recipes’ ),
    ‘public’ => false,
    ‘exclude_from_search’ => true,
    ‘show_in_admin_all_list’ => true,
    ‘show_in_admin_status_list’ => true,
    ‘label_count’ => _n_noop( ‘In preparation CEC <span class=”count”>(%s)</span>’, ‘In preparation CEC <span class=”count”>(%s)</span>’ ),
    ) );

    register_post_status( ‘wc-failed-cec’, array(
    ‘label’ => _x( ‘Failed CEC’, ‘recipes’ ),
    ‘public’ => false,
    ‘exclude_from_search’ => true,
    ‘show_in_admin_all_list’ => true,
    ‘show_in_admin_status_list’ => true,
    ‘label_count’ => _n_noop( ‘Failed CEC <span class=”count”>(%s)</span>’, ‘Failed CEC <span class=”count”>(%s)</span>’ ),
    ) );
    }
    add_action( ‘init’, ‘custom_post_status’ );

    Hi @maximus697

    Thank you for sharing the whole solution with us and with other customers.

    Please let me know if you have any further queries.

    Regards,
    Komal Maru

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘API REST’ is closed to new replies.