Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Hi Babdon,
    The WooCommerce order status is not post/order meta or a custom field but simply a post status in WC2.2 and a taxonomy in older versions (WC2.1-).
    You can just get this from the order object.

    In WC2.1 and older:

    <?php echo $wpo_wcpdf->export->order->status; ?>

    and in WC2.2:

    <?php echo $wpo_wcpdf->export->order->get status(); ?>

    In both cases, it’s the slug (i.e. on-hold instead of “On Hold” etc.) that’s returned/displayed, so instead of echoing straight you might want to convert it first.

    Good luck!
    Ewout

    Plugin Contributor Ewout

    (@pomegranate)

    @babdon, did you manage to show the order status with the above snippets?

    Complete and working solution:

    <?php
    $display_status = $wpo_wcpdf->export->order->status;
    $display_status_label = __( ‘Order status:’, ‘wpo_wcpdf’ );
    ?>

    <span class=”order-date-label”><?php echo $display_status_label; ?></span>
    <span class=”order-date”><?php echo $display_status; ?></span>

    SebiM

    Plugin Contributor Ewout

    (@pomegranate)

    Thanks for sharing SebiM!
    Even simpler, you can leave out those first two lines.

    WC2.1 and older:

    <span class="order-date-label">Order status:</span>
    <span class="order-date"><?php echo $wpo_wcpdf->export->order->status; ?></span>

    WC2.2:

    <span class="order-date-label">Order status:</span>
    <span class="order-date"><?php echo wc_get_order_status_name( $wpo_wcpdf->export->order->get status() ); ?></span>

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Display Order Status in custom template’ is closed to new replies.