Posted on 07/06/2023 08:29:19
							
							
						 
						Hi Jan,
you can try to implement the CustomProductProvider that can override the prices from the ERP. The code should look like that:
using Dynamicweb.Ecommerce.DynamicwebLiveIntegration.Products;
using Dynamicweb.Ecommerce.Prices;
using System.Linq;
namespace Dynamicweb.Ecommerce.DynamicwebLiveIntegration.Examples
{
    /// <summary>
    /// Class CustomProductProvider.
    /// </summary>
    /// <seealso cref="Products.ProductProviderBase" />
    public class CustomProductProvider : ProductProviderBase
    {
        /// <summary>
        /// Gets the price.
        /// </summary>
        /// <param name="product">The product.</param>
        /// <param name="quantity">The quantity.</param>
        /// <returns>PriceInfo.</returns>
        public override PriceInfo GetPriceInfo(LiveContext context, ProductInfo product, double quantity)
        {
            // Example: if we have a price per kilogram - we need to multiply it by quantity
            if (double.TryParse(product["TotalPrice"].ToString(), out double unitPriceWithoutVat))
            {
                double? unitPriceWithVat = (double?)product["TotalPriceWithVat"];
                var currency = Common.Context.Currency;
                if (currency is null)
                    currency = Services.Currencies.GetAllCurrencies().FirstOrDefault();
                var price = new PriceInfo(currency);
                price.PriceWithoutVAT = unitPriceWithoutVat * quantity;
                price.PriceWithVAT = unitPriceWithVat != null ? unitPriceWithVat.Value * quantity : 0;
                return price;
            }
            else
            {
                return base.GetPriceInfo(context, product, quantity);
            }
        }
    }
}
So you need to implement your own custom logic in the GetPriceInfo method to return the price for the specific product instead.
BR, Dmitrij