0

I find that PricingServiceProvider.GetProductPrices(request) return empty array for my new created products, but this function show listprice array for default imported commerce product. Here this it function:

    public virtual ManagerResponse<GetProductPricesResult, IDictionary<string, Price>> GetProductPrices([NotNull] CommerceStorefront storefront, [NotNull] VisitorContext visitorContext, string catalogName, string productId, bool includeVariants, params string[] priceTypeIds)
    {
        Assert.ArgumentNotNull(storefront, "storefront");

        if (priceTypeIds == null)
        {
            priceTypeIds = DefaultPriceTypeIds;
        }

        var request = new Sitecore.Commerce.Engine.Connect.Services.Prices.GetProductPricesRequest(catalogName, productId, priceTypeIds)
        {
            DateTime = this.GetCurrentDate()
        };

        if (Sitecore.Context.User.IsAuthenticated)
        {
            request.UserId = visitorContext.GetCustomerId();
        }

        request.IncludeVariantPrices = includeVariants;
        request.CurrencyCode = StorefrontManager.GetCustomerCurrency();
        var result = this.PricingServiceProvider.GetProductPrices(request);

        Helpers.LogSystemMessages(result.SystemMessages, result);
        return new ManagerResponse<GetProductPricesResult, IDictionary<string, Price>>(result, result.Prices ?? new Dictionary<string, Price>());
    }

I should that I create new products with full fields include List Price in Sitecore commerce server backoffice, but when these products show in product detail page without list price.

Does someone know my problem ? thank all

  • 1
    PricingServiceProvider's GetProductPrices method calls a pipeline "commerce.prices.getProductPrices" and it calls a processor that retrieves product and price details form commerce engine. Look into Sitecore.Commerce.Engine.Connect.Pipelines.Prices.GetProductPrices. You can get empty array when commerce engine is not able to find the product you are looking for. – Vipin Banka Aug 2 at 7:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.