Fulfillment Queries

You can fetch ful­fill­ments for a spe­cif­ic order in your tem­plates or PHP code using ful­fill­ment queries.

{% set order = craft.orders().id(123).one() %}
{% set fulfillments = order.fulfillments %}
use craft\commerce\elements\Order;

$order = Order::find()->id(123)->one();
$fulfillments = $order->getFulfillments();

You can fetch the most recent ful­fill­ment using the code below. This is use­ful for order sta­tus emails auto­mat­i­cal­ly trig­gered by the plugin.

{% set order = craft.orders().id(123).one() %}
{% set fulfillment = order.lastFulfillment %}
use craft\commerce\elements\Order;

$order = Order::find()->id(123)->one();
$fulfillment = $order->getLastFulfillment();