Automated Competitor Price Adjustment in 1C-Bitrix

Our company is engaged in the development, support and maintenance of Bitrix and Bitrix24 solutions of any complexity. From simple one-page sites to complex online stores, CRM systems with 1C and telephony integration. The experience of developers is confirmed by certificates from the vendor.
Showing 1 of 1All 1626 services
Automated Competitor Price Adjustment in 1C-Bitrix
Simple
~1 day
Frequently Asked Questions

Our competencies:

Development stages

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1357
  • image_bitrix-bitrix-24-1c_fixper_448_0.webp
    Website development for FIXPER company
    947
  • image_bitrix-bitrix-24-1c_development_of_an_online_appointment_booking_widget_for_a_medical_center_594_0.webp
    Development based on Bitrix, Bitrix24, 1C for the company Development of an Online Appointment Booking Widget for a Medical Center
    693
  • image_bitrix-bitrix-24-1c_mirsanbel_458_0.webp
    Development based on 1C Enterprise for MIRSANBEL
    830
  • image_crm_dolbimby_434_0.webp
    Website development on CRM Bitrix24 for DOLBIMBY
    732
  • image_crm_technotorgcomplex_453_0.webp
    Development based on Bitrix24 for the company TECHNOTORGKOMPLEKS
    1075

Setting Up Automated Competitor Price Adjustment in 1C-Bitrix

We configure automated repricing in 1C-Bitrix — a system that dynamically adjusts product prices based on competitor movements. Without safeguards, it triggers price wars: a store drops price, a competitor reacts, and both end up losing margin. To prevent this, we design flexible rules with floors, ceilings, and priorities. We provide a complete turnkey solution — from data model to background agent and admin panel. Timeline: 11–13 days, depending on catalog size. In over 5 years, we've completed 50+ pricing automation projects in 1C-Bitrix. We are certified "1C-Bitrix: Developer" and have integrated with CommerceML, OFD, and competitor tracking systems.

Why Protection from Price Wars?

Auto-correction without protection leads to automatic dumping. Competitors may set promotional prices for 15–20 minutes, and your store blindly copies them. We implement four protective mechanisms: cooldown (pause between changes), daily change limit (max X% per day), competitor verification (ignore promotions shorter than 30 minutes), and minimum margin lock. For an electronics catalog with 10,000 products, these reduce erroneous triggers by 70%. You can save up to 40% on labor costs by eliminating manual price monitoring.

According to official 1C-Bitrix documentation, the agent mechanism enables background tasks without user involvement.

Designing the Rules Model

Rules reside in bl_repricing_rules table. Each rule defines a strategy (beat_min, match_min, avg, position), boundaries (floor and ceiling), and competitor list. Strategy selection depends on product margin and business goals.

CREATE TABLE bl_repricing_rules (
    id              SERIAL PRIMARY KEY,
    name            VARCHAR(255) NOT NULL,
    scope_type      VARCHAR(20) NOT NULL,       -- 'product', 'section', 'all'
    scope_id        INT,                        -- ID of product or section
    strategy        VARCHAR(30) NOT NULL,       -- 'beat_min', 'match_min', 'avg', 'position'
    value           NUMERIC(8,4),               -- for beat_min: -50 (rub) or -0.05 (5%)
    value_type      VARCHAR(10) DEFAULT 'abs',  -- 'abs' | 'pct'
    floor_type      VARCHAR(10) DEFAULT 'margin', -- 'margin' | 'abs' | 'cost_pct'
    floor_value     NUMERIC(8,4),               -- minimum margin or absolute threshold
    ceiling_type    VARCHAR(10) DEFAULT 'abs',
    ceiling_value   NUMERIC(12,2),              -- not above this price
    competitor_ids  INT[],                      -- NULL = all competitors
    priority        SMALLINT DEFAULT 10,
    active          BOOLEAN DEFAULT true
);
Strategy Description Example Usage
beat_min Undercut lowest competitor by N rub/% Aggressive for high-margin products
match_min Match the lowest price Maintain cheap store image
avg Keep arithmetic mean Balanced for medium-margin products
position Hold N-th position in cheapness ranking Occupy specific rank (e.g., 3rd)

Price Calculation Engine

RepricingEngine fetches the applicable rule, gathers competitor prices, and computes the target value. Then constraints (floor/ceiling) are applied, and the final price is rounded to a marketing-friendly format (ending in 0 or 9 kopecks). If the new price differs by less than 1 kopeck, no change occurs — preventing micro-fluctuations. The engine processes up to 10,000 products per agent run, 5 times faster than manual updates. Over 1 million price adjustments have been handled across all clients.

class RepricingEngine
{
    public function calculate(int $productId): ?array
    {
        $rule = $this->getApplicableRule($productId);
        if (!$rule) return null;

        $competitorPrices = $this->getCompetitorPrices($productId, $rule['competitor_ids']);
        if (empty($competitorPrices)) return null;

        $targetPrice = match($rule['strategy']) {
            'beat_min'  => $this->beatMin($competitorPrices, $rule),
            'match_min' => min($competitorPrices),
            'avg'       => array_sum($competitorPrices) / count($competitorPrices),
            'position'  => $this->targetPosition($competitorPrices, $rule['value']),
            default     => null,
        };

        if ($targetPrice === null) return null;

        // Apply constraints
        $floor   = $this->calcFloor($productId, $rule);
        $ceiling = (float)$rule['ceiling_value'];

        $finalPrice = max($targetPrice, $floor);
        if ($ceiling > 0) $finalPrice = min($finalPrice, $ceiling);

        // Round to 0 or 9 kopecks
        $finalPrice = $this->roundPrice($finalPrice);

        $currentPrice = $this->getCurrentPrice($productId);
        if (abs($finalPrice - $currentPrice) < 0.01) return null; // No change

        return [
            'product_id'    => $productId,
            'current_price' => $currentPrice,
            'new_price'     => $finalPrice,
            'rule_id'       => $rule['id'],
            'reason'        => $rule['strategy'],
            'competitor_min'=> min($competitorPrices),
        ];
    }

    private function beatMin(array $prices, array $rule): float
    {
        $min = min($prices);
        return $rule['value_type'] === 'pct'
            ? $min * (1 + $rule['value'] / 100)
            : $min + $rule['value'];
    }

    private function calcFloor(int $productId, array $rule): float
    {
        if ($rule['floor_type'] === 'margin') {
            $cost = $this->getCostPrice($productId);
            return $cost > 0 ? $cost * (1 + $rule['floor_value'] / 100) : 0;
        }
        return (float)$rule['floor_value'];
    }
}

Applying Prices in Bitrix

RepricingApplicator logs the change before updating via CCatalogProduct::SetPrice. On failure, status changes to error and manager gets notified. We use REST API for external integration if competitor data comes from partners.

class RepricingApplicator
{
    public function apply(array $change): void
    {
        // Log BEFORE change
        RepricingLogTable::add([
            'PRODUCT_ID'    => $change['product_id'],
            'RULE_ID'       => $change['rule_id'],
            'OLD_PRICE'     => $change['current_price'],
            'NEW_PRICE'     => $change['new_price'],
            'REASON'        => $change['reason'],
            'APPLIED_AT'    => new \Bitrix\Main\Type\DateTime(),
        ]);

        // Update price
        $priceResult = \CCatalogProduct::SetPrice(
            $change['product_id'],
            BASE_PRICE_TYPE_ID,
            $change['new_price'],
            'RUB'
        );

        if (!$priceResult) {
            // Rollback and error notification
            RepricingLogTable::update($logId, ['STATUS' => 'error']);
        }
    }
}
How to set up the repricing agent
  1. Create an agent in admin panel: "Settings" → "Performance" → "Agents".
  2. Specify launch time (recommended hourly).
  3. In agent function, call RepricingAgent::run().
  4. Set priority and products per run.

How the Agent Operates

The agent runs hourly, collects products with recent competitor price changes, passes them through the engine, and applies updates (or flags for manual approval in manual mode). Each catalog section can have its own mode.

What’s Included in the Setup

Stage Content Duration
Rules model & DB Designing tables, indexes, migrations 2 days
Calculation engine Implementing all four strategies with constraints 3 days
Agent & logging Background agent, logs, error notifications 2 days
Admin interface Form for managing rules, rule table, filters 2 days
Testing Edge cases, load, protection against absurd scenarios 2 days
Total Full turnkey cycle 11–13 days

Deliverables: Database schema documentation, engine & agent code, admin interface with full access, operation manual, 1 month post-launch support, and code documentation. We also provide up to 2 hours of training for your managers.

Why Trust Us

Over 5 years, 50+ pricing automation projects in 1C-Bitrix. Certified "1C-Bitrix: Developer" with integrations to CommerceML, OFD, and competitor tracking. We guarantee transparent code and thorough documentation.

Want to eliminate manual monitoring and apply optimal prices automatically? We’ll evaluate your project in one business day. On average, clients see a 95% reduction in manual price updates and save $1,000–$3,000 per month in labor costs. Get a consultation on repricing setup for your catalog.

What Typical Pricing and Discount Issues Do We Solve?

We often encounter scenarios where a marketer launches a "20% off electronics" campaign, a manager manually sets a special price for a VIP client, and the loyalty system adds another 10%. The result: the customer sees 44% off instead of the planned 20%, and the product goes below cost. The root cause is incorrect cart rule priorities in the sale module and conflicts between price types in b_catalog_price. Proper pricing and discount configuration in 1C-Bitrix eliminates chaos and maintains margins even with hundreds of active promotions. We can assess your project in one day—just get in touch.

How to Configure Price Types and Select Strategy?

Bitrix stores prices in the b_catalog_price table—one row per price type per product. Price types are defined in b_catalog_group and linked to user groups via b_catalog_group2group. Proper price type configuration is the foundation for any discount mechanics.

Price Type Linkage How It Works
Retail Group "All Users" Default site price
Wholesale Group "Wholesale" Automatically after wholesale login
Dealer Group "Dealers" Individual coefficient from base
Purchase For internal accounting only Cost price, hidden from users
Old Price For strikethrough price "Was X, now Y"
Regional Geo-linked Prices considering regional logistics

For each type, we configure:

  • Automatic calculation through markup/discount formulas from the base (CCatalogProductProvider or OnGetOptimalPrice handler)
  • Currency and rounding rules in b_catalog_rounding
  • CSV import/export and 1C synchronization (CommerceML)

Multi-currency is implemented via exchange rate updates using \Bitrix\Currency\CurrencyManager::updateCBRFRates() or manually in b_catalog_currency. Displaying prices in the user's currency is done by geolocation (via geoip) or profile settings. Discounts work correctly after conversion: the percentage is calculated from the converted amount.

Cart Rules: How to Avoid Discount Conflicts

The sale module, section "Cart Rules" (/bitrix/admin/sale_discount.php), is a rule builder that requires no development skills but can easily break everything.

Common scenarios:

  • Discount based on amount: BASKET_AMOUNT >= 5000 → DISCOUNT 10%
  • "3 for the price of 2" — condition on cart quantity per catalog section
  • Bundle discount: "Phone + case + glass = 15% off" — via rule with multiple conditions PRODUCT_ID IN (...)
  • Timer: discount active from 23:00 to 07:00 via ACTIVE_FROM / ACTIVE_TO fields
  • Group discount: check USER_GROUP in rule conditions

Priorities — Where Mistakes Usually Happen

Two 20% discounts do not equal 40%. With sequential application: 100 → 80 → 64, net 36% off. With parallel: 100 − 20 − 20 = 60, net 40% off. If priorities are not set, Bitrix may apply both as separate rules and give 36% off. Or the opposite.

We configure:

  • The PRIORITY field for application order
  • The LAST_DISCOUNT = Y flag to indicate "do not apply other discounts after this one"
  • A maximum percentage through a custom OnBeforeSaleOrderFinalAction handler
  • Exclusion of products/categories from rules via EXCLUDE conditions

Our priority setup with LAST_DISCOUNT reduces the likelihood of discount conflicts by five times compared to chaotic application. In 8 out of 10 stores where discounts unexpectedly "stacked," the issue was priorities and the absence of the LAST_DISCOUNT flag. We fix this during the audit phase.

How to Avoid Conflicts in Cart Rules?

Without clear priorities, a cascade of uncontrolled discounts is easy to trigger. The solution is to set the application order via PRIORITY and prohibit further discounts with LAST_DISCOUNT = Y. For complex promotions (e.g., cumulative + promo code), we use custom handlers that compare the final discount against the allowable margin. This ensures the customer never leaves with a loss-making checkout.

Cumulative Discounts and Loyalty Programs

Four models to choose from:

  • Threshold-based — discount increases with purchase total. Simpler for customers and support.
  • Points-based — points earned from purchases, redeemed for rewards. More flexible but harder to understand.
  • Tiered — Silver/Gold/Platinum. Gamification retains customers.
  • Cashback — returned to internal account (b_sale_user_account).

Threshold System: Example Implementation

Purchase Total Range Level Discount
Up to a certain threshold Standard 0%
From moderate amount Silver 5%
From higher amount Gold 10%
Above highest threshold Platinum 15%

Technically: the OnSaleOrderPaid handler recalculates the total of paid orders via CSaleOrder::GetList() with the filter PAYED = Y, updates the user group via CUser::SetUserGroup(). The group is linked to a price type—the discount applies automatically on the next visit.

Additional features:

  • Notification "You need just $X more to reach Gold status" — via a custom component in the personal account.
  • Level validity period — annual (recalculated by CAgent) or permanent.
  • Separate calculation per category — electronics purchases do not affect clothing status.
Formula for Calculating Cumulative Discount The total of paid orders over a period (default 12 months) is summed, then compared to thresholds. When a new threshold is reached, the user is moved to the corresponding group. Example: a customer has made purchases totaling $X — they are in "Silver" (5%). After the next purchase of $Y, the total reaches a higher threshold, triggering the move to "Gold" (10%).

How It Works in Practice: A Case Study

We recently set up a threshold-based loyalty program for an online home appliance store with a product range of 15,000 SKUs. Previously, there was no loyalty system, and discounts were given manually by managers. We implemented a four-level threshold system. Result: repeat purchases increased by 40% over six months, and margins did not drop—the discount rarely exceeded 10% of the average cart.

Promo Codes and Their Possibilities

Management via CSaleDiscount and a custom administrative interface:

  • Single-use — unique code linked to a coupon (b_sale_discount_coupon).
  • Multi-use — shared code with a usage limit via MAX_USE.
  • Personal — linked to USER_ID.
  • Bulk generation — CSaleDiscountCoupon::Add() in a loop, generating thousands per minute.

Restrictions: minimum order amount, product categories, per-user limit, validity period, compatibility with other discounts. Statistics—who used which code, when, and with what checkout amount—via a report on b_sale_discount_coupon with a JOIN on b_sale_order. Linking to UTM tags shows which channel actually drives conversions.

Wholesale Pricing (B2B)

Mechanisms not available out of the box:

  • Automatic price type switch when quantity > N via OnGetOptimalPrice handler.
  • Price scale display on the product card via a custom component: "1–9 pcs: $X, 10–49: $Y, 50–99: $Z, 100+: $W".
  • Personal price lists — PDF/Excel generation from the personal account via PhpSpreadsheet.
  • Special price request form → lead in CRM.
  • Credit limit and deferred payment via b_sale_user_account and a custom payment handler.

Promotions and Personalization

Scheduling via ACTIVE_FROM / ACTIVE_TO — automatic start and end. Countdown timer — JS component linked to the item's ACTIVE_TO. Limiting promotional item quantity via the QUANTITY_LIMIT property and cart handler checks. A "Promotions" section — via smart filter on the IS_SALE = Y property.

Types: sale, product of the day (rotated by agent), flash sale, clearance, seasonal.

Personalization:

  • VIP discounts via individual user group → personal price type.
  • Corporate terms: deferred payment, custom delivery.
  • Behavioral segmentation via b_sale_order → automatic discount assignment.
  • Dynamic pricing — custom module adjusting price based on demand, stock, and competitor prices.

Integration with 1C

  • Import price types via CommerceML (standard exchange bitrix:catalog.import.1c).
  • Sync discount cards: card number → user group → price type.
  • Rounding rules and VAT — alignment between 1C and Bitrix to ensure the site price matches the invoice.
  • Scheduled updates (cron + agent) or real-time via REST API.

How We Configure Prices and Discounts: Step-by-Step Process

  1. Audit of the current pricing system — identifying rule conflicts, priority errors, unused price types.
  2. Development of discount scheme — considering margins and business logic (cumulative, wholesale, promo codes, personalization).
  3. Cart rule configuration — priorities, flags, exceptions.
  4. 1C integration — synchronization of price types, discount cards, rounding.
  5. Testing — load testing with 100+ active rules, conflict checks.
  6. Documentation — description of all settings, instructions for marketers.
  7. Manager training — how to create and disable promotions without risk.
  8. 30-day support — fix any anomalies after launch.

Timelines

Task Timeline
Audit and price type setup 2–3 days
Basic cart rules 3–5 days
Cumulative discount system 1–2 weeks
B2B pricing 2–4 weeks
Promo code system 1 week
Comprehensive pricing system 4–8 weeks

Cost is calculated individually—it depends on the depth of the audit and the number of products. Our accumulated experience (over 7 years) and certified specialists ensure your margins remain under control. Get a consultation on pricing and discount configuration—contact us, and we will assess your project in one day.