magento2检查订单是否已开票或已发货

问题

如何检查商店所有者是否从订单对象发货或开具发票。
$this->registry->registry('current_order');
我有当前的订单对象,我想知道它是否已发货或已开票

答案

if ($order->getInvoiceCollection()->count()) {
    // Invoice exist.
}

if ($order->getShipmentsCollection()->count()) {
    // Shipment exist.
}

另外,您也可以这样做,

$order->hasInvoices() // For Invoice

$order->hasShipments() // For shipment
0 0 投票数
文章评分
0 评论
最旧
最新 最多投票
内联反馈
查看所有评论