A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

Sunil
Nov 28, 2025
  276
(1 votes)

Implementing Custom Line Item Pricing in Optimizely Commerce 14

In many enterprise commerce implementations, business users often need the flexibility to override product pricing at the cart level - especially during customer service operations, B2B negotiations, or manual order creation.

Recently, I had a client requirement where the Super Admin (a special CMS/Commerce role) needed the ability to modify the price of each line item directly from the Cart page.

For Example:
If the default price of a product is $1000, a Super Admin should be able to change it to $900, $850, or any custom value - even if this price is not defined in the price lists.

This custom pricing must also continue to work correctly with:

  • The promotions engine

  • Tax calculations

  • Recalculation workflows

  • Order totals

To meet this requirement cleanly and safely, we needed a way to override PlacedPrice at the line item level in a way that stays aligned with Commerce’s pricing pipeline.

This blog explains the correct, Commerce-native way to implement custom line-item pricing.

 

Use a Custom Price Processor

To implement custom pricing properly, we must plug into Commerce’s pricing pipeline via IPlacedPriceProcessor

1 - Store the Custom Price on the Line Item

When a Super Admin updates the price on the cart page:

lineItem.Properties["SuperAdminCustomPrice"] = customPrice.ToString(); // SuperAdminCustomPrice is meta field
_cartRepository.SaveCart(cart);

This property persists with the cart/item.

2 - Implement the Custom Price Processor

[ServiceConfiguration(typeof(IPlacedPriceProcessor))]
public class SuperAdminPriceProcessor : DefaultPlacedPriceProcessor
{
    public override void ApplyPlacedPrice(
        IOrderGroup orderGroup,
        IOrderForm orderForm,
        ILineItem lineItem,
        IMarket market)
    {
        // Allow Commerce to set its default price
        base.ApplyPlacedPrice(orderGroup, orderForm, lineItem, market);

        // Check for Super Admin’s custom price
        if (!lineItem.Properties.ContainsKey("SuperAdminCustomPrice"))
        {
            return;
        }

        if (decimal.TryParse(
            lineItem.Properties["SuperAdminCustomPrice"].ToString(),
            out var customPrice))
        {
            // Save original Commerce price for audit/rollback
            lineItem.Properties["OriginalPlacedPrice"] = lineItem.PlacedPrice;

            // Apply custom override
            lineItem.PlacedPrice = customPrice;
        }
    }
}

 

3 - How It Looks in the UI

Your “Edit Price” option on the cart page simply updates the custom property:

if (User.IsInRole("SuperAdmin"))
{
    lineItem.Properties["SuperAdminCustomPrice"] = newPrice;
}

 

This was exactly what the client needed:
A clean, production-safe way for Super Admins to override line item prices without breaking any Commerce functionality.

 

Thanks,

Sunil Kumar

 

Nov 28, 2025

Comments

Please login to comment.
Latest blogs
Looking back at Optimizely in 2025

Explore Optimizely's architectural shift in 2025, which removed coordination cost through a unified execution loop. Learn how agentic Opal AI and...

Andy Blyth | Dec 17, 2025 |

Cleaning Up Content Graph Webhooks in PaaS CMS: Scheduled Job

The Problem Bit of a niche issue, but we are building a headless solution where the presentation layer is hosted on Netlify, when in a regular...

Minesh Shah (Netcel) | Dec 17, 2025

A day in the life of an Optimizely OMVP - OptiGraphExtensions v2.0: Enhanced Search Control with Language Support and Synonym Slots

Supercharge your Optimizely Graph search experience with powerful new features for multilingual sites and fine-grained search tuning. As search...

Graham Carr | Dec 16, 2025

A day in the life of an Optimizely OMVP - Optimizely Opal: Specialized Agents, Workflows, and Tools Explained

The AI landscape in digital experience platforms has shifted dramatically. At Opticon 2025, Optimizely unveiled the next evolution of Optimizely Op...

Graham Carr | Dec 16, 2025