Getting Started
Features
Querying Elements
Developers
Fulfillment Queries
You can fetch fulfillments for a specific order in your templates or PHP code using fulfillment 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 fulfillment using the code below. This is useful for order status emails automatically triggered 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();