Answer the question
In order to leave comments, you need to log in
How to add shipping cost to an order on api d7?
D7 - custom api checkout
//укажем доставку, где $_POST['DELIVERY'] - ID службы доставки, в моем случае 9 - Курьер
$shipmentCollection = $order->getShipmentCollection();
$shipment = $shipmentCollection->createItem(
Bitrix\Sale\Delivery\Services\Manager::getObjectById($_POST['DELIVERY'])
);
$shipmentItemCollection = $shipment->getShipmentItemCollection();
Answer the question
In order to leave comments, you need to log in
$service = \Bitrix\Sale\Delivery\Services\Manager::getById($deliveryId);
$deliveryData = [
'DELIVERY_ID' => $service['ID'],
'DELIVERY_NAME' => $service['NAME'],
'ALLOW_DELIVERY' => 'Y',
'PRICE_DELIVERY' => $deliveryPrice,
'CUSTOM_PRICE_DELIVERY' => 'Y'
];
$shipment->setFields($deliveryData);
Here is another way through setBasePriceDelivery (I think it's not D7) https://dev.1c-bitrix.ru/support/forum/forum6/topi...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question