setDeliveryService
\Bitrix\Sale\Shipment::setDeliveryService( \Bitrix\Sale\Delivery\Services\Base $deliveryService );
Метод устанавливает службу доставки для отгрузки. Нестатический метод.
Параметры
| Параметр | Описание | Версия |
|---|---|---|
| $deliveryService | Служба доставки. |
Примеры
$order = \Bitrix\Sale\Order::load($orderId);
$shipmentCollection = $order->getShipmentCollection();
foreach ($shipmentCollection as $shipment) {
if ($shipment->isSystem())
continue;
if($shipment->getDeliveryId() != $valueProps["Значение"]){
//получаем обьект службы доставки по id
$service = \Bitrix\Sale\Delivery\Services\Manager::getObjectById($valueProps["Значение"]);
//изменяем службу доставки в заказе
$shipment->setDeliveryService($service);
}
}
© «Битрикс», 2001-2025, «1С-Битрикс», 2025