Developer forum

Forum » Development » custom Ecommerce mini-cart delete orderline command

custom Ecommerce mini-cart delete orderline command

Christoffer Rosendahl Frede
Reply

Hi all!

I am currently developing a mini-cart in a ViewModelTemplate using the Ecommerce Context.

i have succeded in creating the mini-cart this way, but i am having some problems creating a button that can delete an orderline from the mini-cart.

i have tried using the cart command delete and it works if the product have no discounts. is there some way i can delete an orderline with a frontend button using the Ecommerce Context

and how do i do it?

below is some code describing what i am currently trying to achieve:

Dynamicweb.Ecommerce.Orders.Order cartContext = Dynamicweb.Ecommerce.Common.Context.Cart;
foreach (var product in cartContext.Products)
{
//rendered stuff from the product in mini-cart
<div class="mini-cart">
<a href="/Default.aspx?Id=@(Pageview.ID)?OrderContext=@(cartContext.OrderContextId)&amp;CartCmd=DelOrderLine&amp;key=@(productOrderline.Id)">
                     <i class="icon-trash" aria-hidden="true"></i> Delete Orderline
</a>
</div>
}

best regards Christoffer


Replies

 

You must be logged in to post in the forum