I am developing an eCommerce website on Wordpress using WooCommerce. I want to retrieve and display the 'Shipping Method' (i.e. Delivery or Collection etc.), that the customer had selected at the time of checkout, on the Order Confirmation page (i.e. after payment).
I am trying to do this using get_post_meta($post_id, $key, $single)
function. I am unable to do so as I don't know the $key value.
I tried the following code (within php tag):
echo get_post_meta( $order_id, 'shipping_method', true );
But it returns a blank value (no display on the page). I am assuming that I am using incorrect $key
.
I am open to suggestions to use some other (simpler) method also to achieve this.