Error executing template "Designs/Swift/Paragraph/BuyAllButton_custom.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at Dynamicweb.Ecommerce.Products.ProductService.GetByProductIDs(String[] productIds, Boolean doRefactoring, String productLanguageId, Boolean bulkFill, Boolean useAssortments)
   at CompiledRazorTemplates.Dynamic.RazorEngine_23c09afbdcb443fc8c9d68f500d037b9.Execute() in D:\Solution\BKI LIVE\Files\Templates\Designs\Swift\Paragraph\BuyAllButton_custom.cshtml:line 8
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @using S_DW_BKI_Swift.CustomModules.Extensions @using Dynamicweb.Ecommerce.Products @{ var pageMenuName = "Mine tidligere køb"; string[] productIds = Pageview.User?.GetCustomFieldValue<string>("AccessUser_PreviouslyBought")?.Split(','); IEnumerable<Product> products = Dynamicweb.Ecommerce.Services.Products.GetByProductIDs(productIds, false, Pageview.Area.EcomLanguageId, false, false); string url = "/Default.aspx?ID=" + (GetPageIdByNavigationTag("CartService")); } <div class="grid"> <div class="g-col-8"> <h1>@pageMenuName</h1> </div> <div class="g-col-4 text-end"> <form method="post" action="@url" class="js-buy-all-form"> <input type="hidden" name="redirect" value="false"> <input type="hidden" name="CartCmd" value="addmulti" /> @{ int loopCounter = 1; foreach (var product in products) { <input type="hidden" name="ProductLoopCounter@(loopCounter)" value="@loopCounter" /> <input type="hidden" name="ProductId@(loopCounter)" value="@product.Id" /> if (product.VariantId != null) { <input type="hidden" name="VariantId@(loopCounter)" value="@product.VariantId" /> } <input type="hidden" name="Quantity@(loopCounter)" value="1" /> loopCounter++; } } <button class="btn btn-primary js-add-to-cart-button" onclick="swift.Cart.Update(event);">@Translate("Buy all")</button> </form> </div> </div>