Z
Z
Zzpro2020-12-16 13:53:36
1C-Bitrix
Zzpro, 2020-12-16 13:53:36

How to make a promo code in a get request?

Please give advice on how best to implement the functionality. It is

required that when entering the site with get

?promocode=123456

, a promotional code is applied in the basket when the user goes to the basket.

There is no problem how to apply a promotional code and determine the url. The difficulty is that it should be on all pages of the site, but when a visitor enters the site, the basket has not been created for him yet, the code does not work out.

If the user goes to the cart and is told that the cart is empty, then the cart is created and you can already execute the script and everything works, when the product appears in the cart, the promo code will already work.

Tell me how best to do it, I didn’t find the creation of a basket in the documentation, I’m already thinking when a user enters with a get request, drop the goods and delete immediately so that the basket appears, but this is some kind of perversion, advise how best to do it?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question