Script syntax
Scripts in Pricer24 provide a powerful, flexible environment for dynamic repricing, automated catalog status management, and custom reporting calculations.
Scripts execute within a secure, sandboxed runtime powered by C# / .NET scripting syntax.
Script Types
Pricer24 supports 3 script categories:
- Product Script: Automatically recalculates your store's selling prices based on market competition, modifies availability, sets tags, and updates custom attributes
- Status Script: Automates activating or archiving products based on stock rules or catalog lifecycle
- Analysis Scripts: Dynamically adds custom calculated columns, badges, tooltips, and styling to analytical reports
Global Execution Context (Available to All Scripts)
All scripts receive a shared execution context containing system dictionaries and helper methods:
1. System Reference Dictionaries: Data (Read-only)
Data.MainCurrency— Base system currency code (UAH,EUR,USD)Data.Category— Categories dictionary keyed byExternalIdData.Contractor— Competitor stores dictionary keyed byUnifiedNameData.ProductPriceType— Internal price types dictionary keyed byUnifiedNameData.PriceSet— Price groups dictionary (competitors,competitors_promo)Data.AvailabilityType— Stock availability types dictionary
2. Competitor Market Data
ContractorPrices— Array of competitor prices collected for the current product (ReevaluationContractorPrice[])- Item properties:
Price,Currency,Contractor,PriceSet,Code,Name,Url,ParsedOn
- Item properties:
ContractorOffers— Array of competitor offers:- Item properties:
IsAvail,Contractor,Code,Name,Url,ParsedOn
- Item properties:
3. Built-in Helper Methods
ConvertPrice(price, fromCurrency, toCurrency)— Converts a price using the platform's exchange ratesGetPrices(predicate)— Returns an array wrapper over competitor prices with LINQ helper methods:- Wrapper methods:
.Min(),.Max(),.Avg(),.Any(),.Count()
- Wrapper methods:
GetOffers(predicate)— Returns competitor offers with.Any(),.Count()Round(value, decimals)— Rounds a numeric value to a specified number of digits (negative decimals round to tens, hundreds, etc.)Logs.Add(message)— Appends a debug message to the execution execution log
1. Product Script (Repricing)
Used to automate dynamic price recalculation.
Input Data: ProductOld (Read-only)
Current attributes of your product before script execution:
ProductOld.ExternalId— Product SKU/code in your systemProductOld.Name— Product titleProductOld.Vendor/ProductOld.VendorCode/ProductOld.BarcodeProductOld.Price["UnifiedName"]— Current price by price type nameProductOld.Property["UnifiedName"]— Custom attribute value (e.g., cost price)ProductOld.Tag["UnifiedName"]— Boolean tag state (true/false)
Output Data: Product (Writeable)
Product.Price["UnifiedName"]— New calculated price (numeric ornull)Product.Availability— Updated availability codeProduct.Tag["UnifiedName"]— Assign or remove a product tagProduct.Property["UnifiedName"]— Updated custom attribute value
Practical Repricing Example:
Rule: Set retail price $5 below the lowest in-stock competitor price, but never below cost price + 10% margin.
// 1. Fetch minimum competitor price currently in stock
var competitorPrices = GetPrices(p => p.PriceSet == "competitors");
if (competitorPrices.Any())
{
double minCompetitorPrice = competitorPrices.Min().Value;
double targetPrice = minCompetitorPrice - 5;
// 2. Retrieve cost price from custom product attributes
if (double.TryParse(ProductOld.Property["cost_price"], out double costPrice))
{
double minAllowedPrice = costPrice * 1.10; // Cost + 10% safety margin
if (targetPrice < minAllowedPrice)
{
targetPrice = minAllowedPrice;
Product.Tag["margin_protection"] = true; // Flag for review
}
}
// 3. Write rounded new price
Product.Price["retail_price"] = Round(targetPrice, 0);
}2. Status Script (Catalog Lifecycle)
Controls whether a product remains active in the platform or gets archived.
ProductOld— Product details (same properties as in Product Script).Product.IsActive— Boolean product state (true= active,false= archived).
Example:
Rule: Archive product if out of stock in our store and not offered by any competitor.
bool hasCompetitorStock = GetOffers(o => o.IsAvail).Any();
if (ProductOld.Availability == "out_of_stock" && !hasCompetitorStock)
{
Product.IsActive = false;
}
else
{
Product.IsActive = true;
}3. Analysis Scripts (Custom Report Columns)
Consists of two separate scripts: column definition (Columns) and per-row data calculation (Data).
Columns Definition Script (Executes once):
Columns.Add(
dataField: "PriceDiffPercent",
caption: "Deviation from RRP (%)",
width: 140,
alignment: "Right"
);Cell Data Calculation Script (Executes for each product):
double? myPrice = ProductOld.Price["retail_price"];
double? rrpPrice = ProductOld.Price["rrp"];
if (myPrice.HasValue && rrpPrice.HasValue && rrpPrice.Value > 0)
{
double diff = Round(((myPrice.Value - rrpPrice.Value) / rrpPrice.Value) * 100, 1).Value;
Cell["PriceDiffPercent"].Text = diff + " %";
// Highlight violations in red if selling below RRP
if (diff < 0)
{
Cell["PriceDiffPercent"].Color = "#D32F2F";
Cell["PriceDiffPercent"].Bold = true;
Cell["PriceDiffPercent"].ToolTip = "Selling below Recommended Retail Price!";
}
}Next Steps
- Learn how to push newly recalculated prices to your website in Webhooks: Price Updates
- To pass cost prices and custom fields into Pricer24, see the JSON Catalog Feed Specification
Updated on: 04/11/2026
Thank you!