AI OnAI Off
You can just add meta field on meta class for the interest value. Do you have to implement any extra logic on that? Can you give an high level idea abot your requirements?
if I understand you correctly you want to override price calculation of a variant. For variant "Interest" you want to do a custom calculation to get pricing.
you need to write your own pricing service (or price helper class) that will inherit with DefaultPlacedPriceProcessor & IPlacedPriceProcessor
example snippet
public class PlacedPriceProcessor : DefaultPlacedPriceProcessor, IPlacedPriceProcessor
{
public override bool UpdatePlacedPrice(ILineItem lineItem, CustomerContact customerContact, MarketId marketId, Currency currency, Action<ILineItem, ValidationIssue> onValidationError)
{
// Custom logic
}
public override Money? GetPlacedPrice(EntryContentBase entry, decimal quantity, CustomerContact customerContact,
MarketId marketId, Currency currency)
{
// Custom logic
}
}
Hi,
I am using commerce 13.21 (Foundation), there is a scenario where I have too add interest as a line item for certain orders.
Example:
LineItem 1, SKU 001-001, Qty 2, line item price $5, line item extended price $10
LineItem 2, SKU Interest, Qty 1, line item extended price (based on internal logic)
I am planning to add a variant in the catalog with "INTEREST" as SKU. And then add a meta field "IsInterest" on the lineitem, and then override the DefaultLineItemCalculator's CalculateExtendedPrice method to check for the "INTEREST" lineitem and compute it's price.
Is there a better approach to this?
Regards,
Siddharth
I'm also trying to add a custom field in the line item, do you have an update on this one?