Get deliver address data from scFinishOrder postHook

Hi,

How to get deliver address data from scFinishOrder postHook ?

Thx

Found!

$cr = $modx->newQuery('simpleCartOrderAddress');
$cr->where(array(
'order_id' => $order->get('id'),
'type' => 'delivery'
));

$deliverAddress = $modx->getObject('simpleCartOrderAddress', $cr);

if (!empty($deliverAddress) && is_object($deliverAddress) && $deliverAddress instanceof simpleCartOrderAddress) {
$deliverAdd1 = $deliverAddress->get('address1');

}

I just had to use the right type… ‘type’ => ‘delivery’ :smile:

1 Like