0

I'm working on a WordPress website using JetEngine and Elementor.

I have created a custom query in JetEngine (via Query Builder) that fetches data directly from the database — specifically, WooCommerce order records.

This custom query is then used as the source of a Listing in Elementor, which displays each record using JetEngine's Dynamic Field widget.


Here's the problem:

One of the fields in the query is status, and its values are in English (e.g.):

  • wc-completed
  • wc-pending
  • wc-cancelled

When I use the Dynamic Field widget inside the Listing, these English values are shown directly on the page.


What I want:

I want to translate these field values into Persian for display in the frontend, like:

  • wc-completedتکمیل شده
  • wc-pendingدر انتظار
  • wc-cancelledلغو شده

Limitations:

  • I can only use JetEngine’s Dynamic Field widget inside the Listing.
  • I cannot use HTML widgets, shortcodes, or custom templates.
  • I prefer a solution with minimal or no PHP code, using built-in JetEngine features like:
    • Output filters
    • Macros
    • Callbacks
    • Conditional logic (if available)

My question:

How can I map or translate the field values returned from a custom query in JetEngine, and display them as Persian text inside a Listing, using only the Dynamic Field widget in Elementor?

If there’s no code-free solution, what is the simplest PHP-based workaround (e.g., via a callback function or filter) to transform these values before they are rendered in the Dynamic Field?

Thanks in advance!

1 Answer 1

1
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_label'] = __( 'WC get order status label', 'jet-engine' );

    return $callbacks;
}, 9999 );

/**
 * @param $status
 *
 * @return string
 */
function jet_get_wc_order_status_label( $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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.