conneqt/module-special-prices

N/A

Maintainers

Package info

git.dev.epartment.nl/conneqt/m2/special-prices

Type:magento2-module

pkg:composer/conneqt/module-special-prices

Statistics

Installs: 6 564

Dependents: 3

Suggesters: 0


README

Magento 2 module for customer-specific and group-specific pricing.

It stores price rules in a custom table and applies them during product price rendering, tier price rendering, cart/quote calculation, and customer-facing pricing overview pages.

What this module does

This module lets you define prices for:

  • a specific customer or a customer group
  • a specific SKU or a product group attribute
  • optional quantity breaks
  • optional date ranges
  • optional price list references per store/customer
  • either an explicit price or a discount percentage

Typical use cases:

  • customer contracts
  • B2B assortment pricing
  • store-specific price lists
  • tier pricing outside Magento's native tier-price model
  • guest pricing based on configured price-list references

How it works

  1. Special-price rows are stored in the conneqt_special_prices table.
  2. Each row can target one customer dimension (customer_id or customer_group) and one product dimension (product_sku or product_group).
  3. When Magento renders a product price or recalculates a quote, the module resolves the active customer values, product values, quantity, date range, price-list references, and optional priority.
  4. Matching rows are converted into concrete prices:
    • price is used directly
    • discount is calculated against the current base/final price
  5. If multiple rows match, the configured price_range decides whether the lowest, highest, or average value wins.
  6. The resolved price is then used in product price display, tier price display, and quote item custom prices.

Main features

  • Web API to add and remove special prices
  • Support for customer-based and customer-group-based pricing
  • Support for SKU-based and product-group-based matching
  • Optional guest pricing
  • Optional tier pricing via qty
  • Optional priority filtering
  • Optional Redis-backed result caching
  • Customer account page with a pricing overview
  • Admin pricing overview grid
  • Automatic cleanup cron for stale rows

Requirements

  • PHP >=8.1
  • Magento 2 module: conneqt/module-special-prices
  • Dependency: conneqt/m2-base

Configuration

Magento Admin path:

Stores -> Configuration -> Conneqt -> Special Prices

Important settings include:

  • Enabled: turns the pricing logic on or off
  • Force Special Price: forces the resolved special price even when Magento would normally keep a lower base price
  • Price Range: choose lowest, highest, or average when multiple rules match
  • Guest Customer Special Prices: allows guest users to receive prices from guest price-list mappings
  • Customer Id Attribute: customer attribute used to resolve customer_id
  • Customer Group Id Attribute: customer attribute used to resolve customer_group
  • Customer Group Separator: splits a single customer attribute into multiple group values
  • Product Group Attribute: product attribute used to resolve product_group
  • Update Price: updates an existing matching row instead of inserting a new one
  • Price List References: maps store IDs to guest/customer price-list references
  • Priority Enabled / Priority Order: limits matches to the min/max priority value
  • Enable Convert Currency: converts the resolved price through Magento currency conversion
  • Discount Enabled: writes discount values to quote items when a special price is applied
  • Custom Price Page Enabled: adds a customer account page with active prices
  • Price Result Caching: enables Redis-backed caching of price calculation results
  • Automatic cleanup: removes rows that have not been updated for a configured number of days

Entry points

Frontend

  • Customer account link: special-prices/pricing/overview
  • Layout handle: special_prices_pricing_overview
  • Template: view/frontend/templates/pricing_overview.phtml

Adminhtml

  • Menu entry: Catalog -> Pricing Overview
  • Route frontName: conneqt_specialprices
  • Main grid UI component: view/adminhtml/ui_component/conneqt_pricing_listing.xml

Web API

  • POST /V1/special-prices/addPrices
  • POST /V1/special-prices/removePrice
  • POST /V1/special-prices/removeCustomerPrices
  • POST /V1/special-prices/removeProductPrices

Detailed request/response documentation lives in API.md.

Important files

FileWhat it does
etc/db_schema.xmlDeclares the conneqt_special_prices table and its matching fields such as customer, product, qty, date range, price list, and priority.
etc/di.xmlRegisters the module's API implementations, pricing overrides, and plugins that hook into Magento pricing and quote logic.
etc/webapi.xmlDeclares the REST endpoints for adding and removing prices.
etc/adminhtml/system.xmlDefines all admin configuration options for pricing, caching, frontend page visibility, and cleanup.
Helper/PriceAdd.phpMain write service for inserting/updating prices, deduplicating input, cache invalidation, and cleanup behavior.
Helper/PriceRemove.phpRemoves price rows by customer/product scope.
Helper/PriceGet.phpBuilds the matching query for current customer, product, quantity, date range, price list, and priority.
Helper/PriceList.phpResolves active price-list references from store config and the customer price_list_reference attribute.
Model/PriceCalculator.phpConverts matched rows into final prices and applies the configured lowest/highest/average strategy.
Pricing/Price/SpecialPrice.phpMagento price model that resolves special prices for logged-in and guest customers during storefront rendering.
Pricing/Price/TierPriceExtension.phpExtends Magento tier pricing so special-price rows with qty > 1 appear as tier prices.
Pricing/Price/BasePriceExtension.phpAdjusts Magento base-price selection and optionally forces the special price.
Plugin/QuotePrices.phpApplies the resolved special price to quote items so checkout totals use the same pricing logic.
Plugin/ResultCache.phpCaches price-calculation results in Redis using SKU, customer, quantity, and price-list references in the cache key.
Plugin/CustomerSessionContext.phpPushes customer data into HTTP context so pricing can work during cached storefront rendering.
Block/PricingOverview.phpBuilds the customer account price overview page.
Ui/DataProvider/Pricing/PricingDataProvider.phpFeeds the admin pricing overview grid with joined customer and product data.
Setup/Patch/Data/CustomerPriceListAttribute.phpAdds the customer attribute price_list_reference, used to extend store-level price-list mappings.
Cron/CleanTableCronjob.phpDaily cleanup job for rows that have not been updated recently.

Related extension packages

The following packages extend or integrate with this module:

  • conneqt/module-infor-special-prices
  • conneqt/module-multivers-special-prices
  • conneqt/module-special-prices-search-ultimate
  • conneqt/module-sap-service-layer-special-prices
  • conneqt/module-gransier-special-prices

API documentation

Notes and limitations

The codebase is primarily focused on simple product pricing flows. Based on the current source, the following areas should be verified carefully in a project before production rollout:

  • configurable products
  • grouped products
  • tax interactions
  • interaction with Magento catalog price rules and other discount logic