Remove product from cart
Last updated: 04-May-2017
Rate this article:
Overview
Use this method to remove a product that was added to the shopping cart, during the current session.
Requirements
Parameters
Parameter | Type/Description |
---|---|
sessionID | Required (String) |
Session identifier, which is the output of the Login method. An exception is thrown if the values are incorrect. | |
productId | Required (Integer) |
Unique product identifier from the Avangate system. | |
priceOptions | Optional (StringArray) |
Array of price options codes. These identifiers mark the individual options inside pricing options configuration groups. This parameter must match exactly the pricing option combination of the product added to the cart in order for the product to be removed.
Partner orders can involve the same product, bot ordered in multiple instances, each with different pricing options.
Can be NULL. |
|
quantity | Optional (Integer) |
Defines the number of product units added to cart that should be removed. If no quantity info is provided, the product is completely removed from cart. Can be NULL. |
Response
Parameters | Type/Description |
---|---|
Result | Boolean |
True or false |
Request
<?php
require('PATH_TO_AUTH'); // Authentication example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/SOAP/02Authentication
require('PATH_TO_setPartner'); // setPartner example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/SOAP/06Reference/Partner/00Set_partner
require('PATH_TO_addProduct'); // addProduct example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/SOAP/06Reference/08Place_an_order/00Add_product_to_cart
$productId = 'YOUR_PRODUCT_ID';
$priceOptions = array(
'Pricing_options_group_code1',
'Pricing_options_group_code2'
);
$quantity = YOUR_QUANTITY;
try {
$RemoveProduct= $client->deleteProduct ($sessionID, $productId, $priceOptions, $quantity);
} catch (SoapFault $e) {
echo "ProductDeleted: " . $e->getMessage();
exit;
}
var_dump ("ProductDeleted ", $RemoveProduct);
Errors
Error | Description |
---|---|
EMPTY_CART |
The shopping cart is empty. |
PRODUCT_ERROR |
There is no product with the specified settings in cart. |
Rate this article: