Retrieve active promotions in cart
Use this method to list all promotions applied to products added to the cart.
Requirements
This method requires you to set a specific partner using setPartner.
Request parameters
sessionID
Required (string)
Session identifier, output of the Login method. An exception is thrown if the values are incorrect.
Request sample
<?php
require ('PATH_TO_AUTH'); // Authentication example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/JSON-RPC/02Authentication
require ('PATH_TO_setPartner'); // setPartner example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/JSON-RPC/06Reference/Partner/00Set_partner
$jsonRpcRequest = array (
'jsonrpc' => '2.0',
'id' => $i++,
'method' => 'getPromotions',
'params' => array($sessionID)
);
var_dump (callRPC((Object)$jsonRpcRequest, $host));Response parameters
Promotion
Array of objects
Details below.
Promotion.Name
String Promotion name
Promotion.Description
String Promotion description
Promotion.StartDate
String Promotion start date. NULL for promotions that start immediately after they're created.
Promotion.EndDate
String Ending date. The date when you set the promotion to end. NULL for promotions that are active indefinitely.
Promotion.MaximumOrdersNumber
Int When the maximum number of orders is reached the promotion stops. NULL for unlimited number of orders.
Promotion.MaximumQuantity
Int Discount applies to a specific number of products, smaller than the maximum defined quantity. NULL for unlimited number of units. Any extra quantity added to the cart will be sold at full price.
Promotion.InstantDiscount
Boolean Selecting the instant discount option auto-applies the discount for ALL the selected products for all shoppers, without the need to enter the discount coupon.
Promotion.Coupon
String Promotion coupon/voucher.
Promotion.DiscountLabel
String Set discounts as percentage from the product price or as a fixed amount in the chosen currency.
Errors
EMPTY_CART
The shopping cart is empty.
NO_PROMOTIONS
There are no promotions applied to the current shopping cart.
Last updated
Was this helpful?