• Resolved loopforever

    (@loopforever)


    Hello,
    I am adding new order status using source here (weDevs) However, although it should only appear in the “span” tag, it also appears in “td” tag.
    Please look at the image: Image Link
    What’s the problem ? Can you help me ?

    My Code:

    function rregister_new_order_status_for_vendor() {
      register_post_status( 'wc-vendor-approve', array(
        'label' => _x( 'Getting ready', '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( 'Getting ready (%s)', 'Getting ready(%s)', 'woocommerce' )
      ) );
    }
    add_action( 'init', 'rregister_new_order_status_for_vendor' );
    /**
    * Add new custom status for WC order statuses
    *
    * @param array $order_statuses
    *
    * @return array $order_statuses
    */
    function rregister_to_wc_new_order_status_for_vendor( $order_statuses ) {
      $order_statuses[ 'wc-vendor-approve' ] = _x( 'Getting ready', 'Order status', 'woocommerce' );
      return $order_statuses;
    }
    add_filter( 'wc_order_statuses', 'rregister_to_wc_new_order_status_for_vendor', 12, 1 );
    
    /**
    * Add new custom status button class on order status
    *
    * @param string $text
    * @param string $status
    *
    * @return string $text
    */
    function dokan_get_order_status_class_t( $text, $status ) {
      switch ( $status ) {
        case 'wc-vendor-approve':
        case 'vendor-approve':
          $text = 'success';
      }
    
      return $text;
    }
    add_filter( 'dokan_get_order_status_class', 'dokan_get_order_status_class_t', 10, 2 );
    
    /**
    * Custom order status translated
    *
    * @param string $text
    * @param string $status
    *
    * @return string $text
    */
    function dokan_add_custom_order_status_translated_t( $text, $status ) {
      switch ( $status ) {
        case 'wc-vendor-approve':
        case 'vendor-approve':
          $text = __( 'Getting ready', 'dokan-lite' );
          break;
      }
      return $text;
    }
    add_filter( 'dokan_get_order_status_translated', 'dokan_add_custom_order_status_translated_t', 10, 2 );
    • This topic was modified 3 years, 9 months ago by loopforever.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @loopforever,

    I’ve tested and didn’t get the problem with the above code you shared. The custom order status is showing only inside the span tag in my local testing.

    There might have a cache issue on your site, maybe that’s why you’re having the problem. In that case, clear your site cache as well as the browser cache and try again.

    If you’re still having the problem, then kindly contact us through our support channel.

    Best Regards,

    Thread Starter loopforever

    (@loopforever)

    Thank you for your answer.
    I did everything you said. Is there any other possible scenario?
    My theme support period has ended. Because of this, I cannot contact you. Could this be related to the theme?

    Hi @loopforever,

    The problem you’re facing will require checking your site properly. So, kindly contact us through our support channel.

    Thank you,

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Dokan New Order Status Problem’ is closed to new replies.