How to access custom fields from order in thank you page woocommerce

I have a lot of custom fields I have created in my order, I am trying to now access them when the order is completed on the thank you page.

I have seen this response but it does not work for me. I do a var dump to see what’s inside of $order->order_custom_fields but I just get string(0) ""

Read More

I am editing the file order-details-customer.php How can I access my custom fields?

Here is an example of a custom field I have created

        woocommerce_form_field( 'destination_state', array(
        'type'          => 'text',
        'class'         => array('destination_state form-row-first'),
        'label'         => __('State'),
        'required'      => true,
        ), $checkout->get_value( 'destination_state' ));

Related posts

Leave a Reply

1 comment

  1. After a bit of searching and just logical thinking I figured out that it’s very easy.

    echo '<p>' . get_post_meta(  $order->id, 'Date Collection', true ) . '</p>';