1
我需要通過woocommerce訂單ID或訂單號在wordpress中獲取post_id。如何從woocommerce的order_id中獲取post_id
global $woocommerce, $post;
$order = new WC_Order($post->ID);
//to escape # from order id
$order_id = trim(str_replace('#', '', $order->get_order_number()));
與此代碼我從訂單ID獲取訂單ID。我必須扭轉這一點,並從訂單ID獲取帖子ID。
看看這個[url](http://wordpress.stackexchange.com/questions/97176/get-product-id-from-order-id-in-woocommerce) – Gunaseelan