cowboysaif
cowboysaif

Reputation: 241

Detailed shipping method information from order in woocommerce

I am working on a website where i need to get shipping carrier name ( e.g. USPS ) , carrier description ( First-Class Mail® (USPS) ) and carrier code ( e.g. USS 04 ). Now i can see this information in the order details page but how i can get this information on plugin ? WC_order or WC_shipping has no function to get this. I searched through mysql and it seems two tables store this information wp_postmeta and wp_woocommerce_order_items

Do i have to get this from sql ?

Upvotes: 0

Views: 722

Answers (1)

belfort1
belfort1

Reputation: 927

if you have the WC_Order in $order, you can access the shipping method name by:

$order->get_shipping_method()

Upvotes: 1

Related Questions