T
T
tgarl2021-07-05 11:37:36
1C-Bitrix
tgarl, 2021-07-05 11:37:36

How to add a product with its discount coupon to the cart?

I can't find a solution at all.
The essence of the problem is this: the client throws goods into the basket. Each product can be paid only through its own legal entity (own payments).
All warehouses are divided into legal entities. Therefore, what I do is I send data at the last step of placing an order to a script that makes the separation of goods. I get an array of legal entity -> product, quantity.
Next, I take out everything in the basket. And I create an order for the first legal entity, then for the second ...

Everything seemed to work, but then they got a discount with promotional codes. I can’t find / figure out how to take into account these promotional codes.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
tgarl, 2021-07-05
@tgarl

found a solution: after saving the basket, we call its new object and work further with it, and all discounts from the basket are applied. It's weird, but it works

$basket->save();
$basket = \Bitrix\Sale\Basket::loadItemsForFUser( $fuser,   's1'   );

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question