Update special price promotion
Use the UpdateSpecialPricePromotion method to modify promotion at a special price.
Request parameters
Parameter
Type / Description
promotionCode
Required (string) Code of the promotion that you want to update.
sessionID
Required (string) Unique identifier of the session.
existingPromotion
Required (string) Details of the existing promotion.
PriceMatrix
Required (array of objects)
Only for this type of promotion. It is generated by the getPriceMatrix call and used to set promotion special prices.
Request sample
<?php
require ('PATH_TO_AUTH');
// Retrieve promotion details
$promotionCode = 'PROMOTION_CODE'; // code of the promotion that you want to update
try {
$Promotion = $client->getPromotion($sessionID, $promotionCode);
}
catch (SoapFault $e) {
echo "Promotion: " . $e->getMessage();
exit;
}
var_dump("Promotion", $Promotion);
// Keep the promotion you want to update in $existingPromotion
try{
$existingPromotion = $client->getPromotion($sessionID, $promotionCode);
}
catch (SoapFault $e) {
echo "Existing Promotion: " . $e->getMessage();
exit;
}
// Set the fields to update
$priceMatrixDefinition1 = new stdClass;
$priceMatrixDefinition1->ProductCode = "test";
$priceMatrixDefinition1->PricingConfigurationCode = "738C6A2049";
$priceMatrixDefinition1->OptionHash = "708e43960c4edc42f14cf388bcb24bde";
$option1 = new stdClass;
$option1->GroupName = "Units";
$option1->OptionText = "1 - maximum";
$price1 = new stdClass;
$price1->Value = 20;
$price1->Currency = "USD";
$price2 = new stdClass;
$price2->Value = 15;
$price2->Currency = "EUR";
$priceMatrixDefinition1->Options = [$option1];
$priceMatrixDefinition1->Prices = [$price1, $price2];
$existingPromotion->DefaultCurrency = 'USD';
$existingPromotion->PriceMatrix = [\
$priceMatrixDefinition1\
];
// Update the promotion
try {
$updatedPromotion = $client->updatePromotion($sessionID, $existingPromotion);
}
catch (SoapFault $e) {
echo "UpdatedPromotion: " . $e->getMessage();
exit;
}
var_dump("UpdatedPromotion", $updatedPromotion);
?>Response sample
Last updated
Was this helpful?