79706819

Date: 2025-07-18 23:05:19
Score: 0.5
Natty:
Report link
wp-content/mu-plugins/jet-wc-orders-status-callback.php
<?php

add_filter( 'jet-engine/listings/allowed-callbacks', static function ( $callbacks ) {
    $callbacks['jet_get_wc_order_status'] = __( 'WC get order status label', 'jet-engine' );

    return $callbacks;
}, 9999 );

/**
 * @param $status
 *
 * @return string
 */
function jet_get_wc_order_status( $status ) {
    if ( ! is_scalar( $status ) ) {
        return '-';
    }

    if ( ! function_exists( 'wc_get_order_statuses' ) ) {
        return $status;
    }

    $labels = wc_get_order_statuses();

    return $labels[ $status ] ?? '-';
}

enter image description here

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Mahdi Akrami