foreach (var paymentInfoCarrier in orderCarrier.PaymentInfo)
{
foreach (var paymentRow in paymentInfoCarrier.Rows)
{
switch (paymentRow.ReferenceType)
{
case Foundation.Modules.ECommerce.Payments.PaymentInfoRowType.OrderRow:
// here is where I need the variantID
// this is inside the litium.voyado plugin, need to fetch variant details.
}
}
}
I tried this locally, putting your code in a simple test controller with the following code and I get the expected variants. Is your product setup different? My free gift product is using the template Product with only one variant.
public IHttpActionResult Index()
{
var orderCarrier = ModuleECommerce.Instance.Orders.GetOrder("LS100008", ModuleECommerce.Instance.AdminToken).GetAsCarrier(true, true, true, true, true, true);
var variants = new List<string>();
foreach (var paymentInfoCarrier in orderCarrier.PaymentInfo)
{
foreach (var paymentRow in paymentInfoCarrier.Rows)
{
switch (paymentRow.ReferenceType)
{
case Foundation.Modules.ECommerce.Payments.PaymentInfoRowType.OrderRow:
// here is where I need the variantID
// this is inside the litium.voyado plugin, need to fetch variant details.
var variantId = orderCarrier.OrderRows.FirstOrDefault(x => x.ID.ToString() == paymentRow.ReferenceID)?.ArticleNumber;
variants.Add(variantId);
break;
}
}
}
return Json(variants);
}
If the order is re-calculated, then the added rows from campaigns will be removed and then added again, that make them get a new OrderRowID and the reference is not matching any more. Is the order re-calculated after it is placed?
Hi @patric.forsgard
I have checked this and the campaign row get a new OrderRowId even before the order is placed.
It keeps changing when we refresh the checkout page.