Documentation
/ Documentation
Integration handbook

Basket and Offer Selection

Add to basket must change the visitor's actual basket, not merely display a success icon. For Bitrix, verify the selected offer, current session, store response and price on the native basket page. Adding a product is not a purchase confirmation.

On this page

When Adding Is Available

Connect the catalogue, provide product and offer identifiers and install the widget first. The store needs a working basket and an add handler. The native Bitrix module uses /local/ajax/anmarto_cart.php and the catalog, sale and abr.search modules. Loading a widget script does not create a basket on an arbitrary website.

On another platform, the integration must handle adding through a callback, anmarto:add-to-cart event or data-cart-url server address. Do not attach several independent handlers that all add the same item. When cart is disabled, the consultant should link to the product page rather than claim an action was completed.

Value What to verify Why it matters
id Catalogue product identifier Identifies the parent product
offer_id Selected size, colour or other variant A specific variant must reach the basket
quantity Positive quantity and selling unit Items, packs and area are not interchangeable
sessid Valid Bitrix session Action belongs to the current visitor
op_id Identifier of one action A retried response must not duplicate the item

Check Variants and Availability

  1. Find a product with several offers and open variant selection.
  2. Choose the required colour or size; compare that variant's price and availability.
  3. Select Add to basket once and wait for the result.
  4. Open the store's native basket in the same browser.
  5. Compare variant name, quantity, price and currency, not just the parent card.

Data distinguishes in_stock, backorder and out_of_stock. Explicit out_of_stock removes the card's purchase button; backorder allows ordering according to store rules. Without an explicit state, is_available: false may display as Available to order rather than Out of stock. Correct the source data when the store needs to distinguish these cases.

The index reflects the most recently processed catalogue. Actual adding is checked by the store and its product provider. Changed stock, purchase restrictions or an unavailable offer may cause rejection even if the card previously showed availability. A positive parent total does not prove the selected size is available.

Card Price and Basket Price

The card price comes from the index; Bitrix calculates the basket line for the current visitor, including applicable discounts. The result can differ. The handler returns card_price, price, currency, price_changed and price_verified. The widget reports a confirmed difference instead of silently retaining the old price.

When the displayed-price calculation is unconfirmed, price_verified: false and price_changed: null mean unverified, not matching prices. Open the basket and check current store terms. The integration does not promise universal calculation of delivery, every bundle, room area, minimum order quantities or customer-specific agreements. Such scenarios require the individual store's rules and handlers, not assumptions about a selected offer.

Retry after a Network Failure

When a response is lost, it is unknown whether the store saved the action. Retrying an unfinished operation uses the same op_id and retry: true. Bitrix retains successful responses in the session for up to 15 minutes, with a maximum of 50 operations, and replays the response without adding again. This is limited protection within the same session, not a permanent guarantee after clearing cookies or changing browsers.

After a confirmed result, the next intentional click creates a new operation and really increases quantity. Do not test retry protection with a new purchase click: that is a different case. If the result is uncertain, inspect the actual basket first and then use the offered retry.

Chat Actions and Errors

Reading basket contents requires getCart; changing quantities and removing items require the corresponding handler. A checkout link requires checkoutUrl. External order status needs a separate onToolCall and store access; it is not automatically supplied with the basket. Consent to an action is not confirmation of payment or purchase.

Symptom Cause Action
bad_sessid, access rejected Stale session or page Refresh the store page and retain the selected variant
Wrong size added Missing offer_id Correct offer transmission
basket_error Store restriction, stock or provider Read the message and check the product on the website
Success icon but empty basket No real-handler confirmation Check integration; do not count the icon as a purchase
Price differs Current store price or discount Compare the basket and update the catalogue if necessary

Perform full acceptance using the checklist. Separate catalogue-loading issues from basket errors in troubleshooting.