Fix empty purchase units error on shipping

This commit is contained in:
Emili Castells Guasch 2025-07-09 14:54:08 +02:00
parent d5190d2e74
commit d4c5d31b77
No known key found for this signature in database

View file

@ -89,8 +89,9 @@ class WooCommerceOrderCreator {
}
try {
$payer = $order->payer();
$shipping = $order->purchase_units()[0]->shipping();
$payer = $order->payer();
$purchase_units = $order->purchase_units();
$shipping = ! empty( $purchase_units ) ? $purchase_units[0]->shipping() : null;
$this->configure_payment_source( $wc_order );
$this->configure_customer( $wc_order );