Woocommerce 从商业订单中获取发票号

Woocommerce 从商业订单中获取发票号,woocommerce,Woocommerce,我正在尝试将商业订单导出到我的CRM。我能够得到行项目、数量和价格,但我错过了发票号码 function custom_woocommerce_complete_order_crm( $order_id ) { global $woocommerce; if ( !$order_id ) return; $order = new WC_Order( $order_id ); $order_items = $order->get_items();

我正在尝试将商业订单导出到我的CRM。我能够得到行项目、数量和价格,但我错过了发票号码

function custom_woocommerce_complete_order_crm( $order_id ) {
    global $woocommerce;
    if ( !$order_id )
    return;
    $order = new WC_Order( $order_id );

    $order_items = $order->get_items();

    foreach( $order_items as $product ) {
        $product_name[] = $product['name']; 
        $product_qty[] = $product['qty']; 
    }

...

var_dump对我没有帮助,WooCommerce文档也没有说明任何有关发票的内容。

如果您没有在WooCommerce上使用任何函数来获得子序列订单号,您只需获取post ID即可

比如:

$orderid = get_the_id();
发票号码是指订单id吗


希望这有帮助

不,我指的是发票id。您是否使用其他插件添加发票id?不。发票是WooCommerce的标准功能。我现在可以告诉您,发票不是标准功能。也许这就是为什么你在woothemes上找不到任何关于它的文档。@danyo WooCommerce中有发票号码或ID。。。这取决于支付网关。。例如,在Paypal中,它默认为
WC-{order\u id}
。。您可以在Paypal网关下的结帐设置中设置
WC-
。。
$invoice number = $order->get_order_number();