sale.basketitem.addCatalogProduct
sale.basketitem.addCatalogProduct(id, fields)
The method adds catalog product shopping cart item.
When successful, returns shopping cart resource in response body.
Compared to sale.basketitem.add, the method sale.basketitem.addCatalogProduct receives minimal set of fields to add an entry to shopping cart. When this method is called, product fields are automatically filled with values from system provider, thus simplifying handling of shopping cart
Parameters
Parameter | Type | Description |
---|---|---|
id | string | Number of element for shopping cart. |
fields | object | Fields, corresponding to the available list of sale.basketItem.getFieldsCatalogProduct fields. |
Examples
BX24.callMethod( 'sale.basketitem.addCatalogProduct', { fields: { productId: 227, quantity: 2, name: 'Dress' } }, function(result) { if (result.error()) console.error(result.error().ex); else console.log(result.data()); });
© «Bitrix24», 2001-2024