# Campaign Prices

This guide will walk you through the steps of managing campaign prices for a group of products using Quicklizard.

# Use Case

Use Quicklizard to define a campaign that runs for a given time period, add products to the campaign, and assign discount prices for each campaign product.

Use Quicklizard's REST API to read the campaign prices and save them into your ERP as the products' shelf price for the duration of the campaign, updating Quicklizard with the new shelf prices for each product.

When your campaign is over, reset campaign products' shelf price to their original value in your ERP, updating Quicklizard with the original shelf prices for each product.

# Step 1 - Create a new Campaign

Sign in to Quicklizard and go to the "Campaigns" tab, where you can create a new campaign. Select a descriptive name for your campaign, set the campaign start and end dates, and use the provided search facility to add products to your campaign.

Once you added all the products that participate in your campaign, set their % discount level or campaign price and save the campaign.

# Step 1 - Read Campaign Prices

Use Quicklizard's REST API to call the GET /api/v2/campaigns endpoint and iterate over the results. Each result is a campaign defined by you or your team as described in step 1.

For each campaign in the API response, iterate over the products array and grab the campaign_price field - Use that field as the new value of each product's shelf price for the duration of the campaign and save it to your ERP.

# Step 2 - Send Campaign Prices to Quicklizard

Once the campaign prices are updated in your ERP, use the PUT /api/v2/products/bulk_update to send the campaign prices to Quicklizard.

The campaign prices replace your shelf price for the duration of the campaign - please make sure you set the value of the price field of your bulk update API payload to the product's shelf price, which should now be the same as the campaign_price field of each campaign product.

# Step 3 - Reset Campaign Prices

When a campaign is finished, you must reset the campaign products' prices back to their original value. Use Quicklizard's REST API to call the GET /api/v2/campaigns endpoint and iterate over the results, looking for any campaign with an end_date value that is in the past.

For each campaign you found, iterate over the products array and grab the base_price field, which contains the product's original shelf price, and save it to your ERP.

# Step 4 - Send Shelf Prices to Quicklizard

Once the original shelf prices are updated in your ERP, use the PUT /api/v2/products/bulk_update to send them to Quicklizard.

Please make sure you set the value of the price field of your bulk update API payload to the product's shelf price, which should now be the same as the base_price field of each campaign product.

# Additional Notes

It is your responsibility to keep track of which campaigns were processed when you update campaign prices or reset them to the campaign products' original shelf prices.

For your convenience, each campaign has a unique identifier which you can use to keep track of what actions where taken for each campaign.

# Relevant API Endpoints