Appearance
Vendor orders
VendorOrder is where many marketplace concepts meet: it is a single vendor's own slice of a Sylius order, holding the SyliusOrderItems that belong to that vendor (their products, chosen variants and quantities).
Each VendorOrder is assigned to the channel in which it was created and to the currency of the underlying Sylius order.
How a VendorOrder is created
A VendorOrder is generated automatically, one per vendor present in the order, when the customer's payment completes (workflow.sylius_order_payment.completed.pay). Generation is idempotent: re-firing the event for an order that already has a VendorOrder for a given vendor does not create a duplicate or change its amounts.
You will rarely need to create one by hand, but if you do:
php
<?php
/** @var \Sylius\Resource\Factory\FactoryInterface $vendorOrderFactory */
$vendorOrderFactory = $this->container->get('odiseo_marketplace.factory.vendor_order');
/** @var \Odiseo\SyliusMarketplacePlugin\Entity\VendorOrderInterface $vendorOrder */
$vendorOrder = $vendorOrderFactory->createNew();
/** @var \Sylius\Component\Channel\Model\ChannelInterface $channel */
$channel = $this->container->get('sylius.context.channel')->getChannel();
$vendorOrder->setChannel($channel);
$currencyCode = $this->container->get('sylius.context.currency')->getCurrencyCode();
$vendorOrder->setCurrencyCode($currencyCode);
/** @var \Odiseo\SyliusMarketplacePlugin\Repository\VendorOrderRepositoryInterface $vendorOrderRepository */
$vendorOrderRepository = $this->container->get('odiseo_marketplace.repository.vendor_order');
$vendorOrderRepository->add($vendorOrder);The VendorOrder state machine
The state field (graph odiseo_marketplace_vendor_order) tracks the vendor's own fulfilment progress — it does not mean "paid out"; settlement is tracked separately by the vendor's ledger.
| State | Meaning |
|---|---|
new | Just generated, awaiting fulfilment. |
cancellation_requested | The vendor asked to cancel; waiting for the administrator. |
fulfilled | The vendor marked its slice as fulfilled. |
cancelled | The slice was cancelled (by the admin approving a request, or directly). |
Transitions: fulfill (new → fulfilled), request_cancellation (new → cancellation_requested), reject_cancellation (cancellation_requested → new), cancel (new, cancellation_requested → cancelled).
There is a separate paymentState field (graph odiseo_marketplace_vendor_order_payment, places awaiting_payment/paid/partially_refunded/refunded/cancelled) that mirrors the customer's payment on the parent Sylius order — it is set to paid when the VendorOrder is generated and moves to partially_refunded/refunded if the customer is refunded. It is unrelated to how or when the vendor gets paid.
Cancellations and refunds
Cancellation follows the marketplace standard: the vendor requests, the administrator decides.
- The vendor opens a vendor order and clicks Request cancellation, choosing a reason (out of stock / customer request / product issue / other) and an optional note. This is blocked once the order has been shipped.
- The administrator reviews the request (filter the vendor orders grid by state) and approves or rejects it.
When a cancellation is approved, the plugin automatically:
- cancels the vendor's payout for that order (the vendor's earning is clawed back on their ledger),
- gives back on-hand stock for the vendor's tracked items,
- notifies the customer and the vendor.
The customer refund is NOT automatic. The plugin does not move money back to the customer — it only settles the vendor side. After approving a cancellation you must issue the customer's refund through your payment gateway or Sylius' own refund tooling. The admin vendor order screen shows a "refund pending" reminder while this is outstanding.
When a request is rejected, the vendor order returns to new, the stored reason/note are cleared, and the vendor is notified.
Money and settlement
Generating a VendorOrder posts an earning entry to the vendor's ledger — for how that amount is calculated (commission, tax handling) and how the vendor gets paid, see Settlement and the ledger and Vendor payments.