Woocommerce Display Custom Field value on the Thank You page [Custom Field Display 2] code example

Example: Woocommerce Display Custom Field value on the Thank You page [Custom Field Display 2]

/**
 * Display field value on the Thank You page..
 *
 * PHP Custom Feild Value
 * 
 * 
 */

add_action( 'woocommerce_thankyou', 'misha_view_order_and_thankyou_page', 20 );
add_action( 'woocommerce_view_order', 'misha_view_order_and_thankyou_page', 20 );
function misha_view_order_and_thankyou_page( $order_id ){  ?>
    <h2>Location You Choose</h2>
    <table class="woocommerce-table shop_table gift_info">
        <tfoot>
            
            <tr>
                <th scope="row">Store Location</th>
                <td><?php echo get_post_meta( $order_id, 'My Field', true ); ?></td>
            </tr>
          
        </tfoot>
    </table>
<?php }

Tags:

Php Example