Skip to main content
knowledgecenter.avangate.com

Retrieve active promotions in cart

Overview

Use this method to list all promotions applied to products added to cart.

Requirements

This method requires you to set a specific partner using setPartner.

Parameters

Parameter Type/Description
sessionID Required (String)
  Session identifier, output of the Login method. An exception is thrown if the values are incorrect.

Response

Parameter Type/Description

Promotion

Array of objects

 

Details below

 

Name

String

 

 

Promotion name

 

Description

String

 

 

Promotion description

 

StartDate

String

 

 

Promotion start date. NULL for promotions that start immediately after they're created.

 

EndDate

String

 

 

Ending date. The date when you set the promotion to end. Is NULL for promotions that you want active indefinitely.

 

MaximumOrdersNumber

Int

 

 

When the maximum number of orders is reached the promotion stops. NULL if you want the promotion to apply to an unlimited number of orders.

 

MaximumQuantity

Int

 

 

Discount only applies to a specific number of products, smaller than the maximum defined quantity. NULL if you want the promotion to apply to an unlimited number units. Any extra quantity added to the cart will be sold at full price.

 

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.

 

Coupon

String

 

 

Promotion coupon/voucher.

 

DiscountLabel

String

 

 

Set discounts as percentage from the product price or as a fixed amount in the chosen currency.

Request

<?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));

Errors

Error Description

EMPTY_CART

The shopping cart is empty

NO_PROMOTIONS

There are no promotions applied to current shopping cart