We have a weird problem that only occurs in specific scenarios, but we cannot seem to find out why its happening.
Scenario
Customer adds product to cart, goes through checkout process (Billling Address > Shipping address > Shipment Cost) and then chooses paypal. They are redirected to paypal, but paypal has an error or they decide at the last minute this is not the right product.
So they click back to go back to the site. The basket still has their order/purchase order in it. They clear the basket (Our code below, please ignore the _eCommerceService as we have wrapped all the uCommerce stuff up in our own class, so its just the UCommerce library in it)
var basket = _eCommerceService.Basket.PurchaseOrder;
foreach (var orderLineId in basket.OrderLines.Select(x => x.OrderLineId).ToList())
{
_eCommerceService.Basket.UpdateLineItem(orderLineId, 0);
}
var shipments = new List<Shipment>();
shipments.AddRange(basket.Shipments);
shipments.ForEach(x => basket.UPurchaseOrder.RemoveShipment(x));
_eCommerceService.Basket.ExecuteBasketPipeline();
Once they have emptied their basket they decide they want something else, add that to cart and go through the checkout again. This time when they get to PayPal, it seems to have added the previous shipment amount to the new shipment amount they have selected (Basically they get charged shipping twice?).
What we can't figure out is how/where the previous shipment is appearing from? As you can see we clear the shipments on emptying the cart? As soon as they order is successfully completed, its all reset and works correctly?
Hope that makes sense... As I say its a specific scenario, but an annoying one as we have no idea why its doubling up the shipment.
We are using the build in API method chap? We have just wrapped up all the UCommerce objects into our domain objects, and wrapped up the API methods into our own interfaced service/repos.
This way, in theory we could rip out uCommerce and replace it with a different ecommerce platform or our own custom one.
Double Shipment Issue
We have a weird problem that only occurs in specific scenarios, but we cannot seem to find out why its happening.
Scenario
Customer adds product to cart, goes through checkout process (Billling Address > Shipping address > Shipment Cost) and then chooses paypal. They are redirected to paypal, but paypal has an error or they decide at the last minute this is not the right product.
So they click back to go back to the site. The basket still has their order/purchase order in it. They clear the basket (Our code below, please ignore the _eCommerceService as we have wrapped all the uCommerce stuff up in our own class, so its just the UCommerce library in it)
var basket = _eCommerceService.Basket.PurchaseOrder; foreach (var orderLineId in basket.OrderLines.Select(x => x.OrderLineId).ToList()) { _eCommerceService.Basket.UpdateLineItem(orderLineId, 0); } var shipments = new List<Shipment>(); shipments.AddRange(basket.Shipments); shipments.ForEach(x => basket.UPurchaseOrder.RemoveShipment(x)); _eCommerceService.Basket.ExecuteBasketPipeline();
Once they have emptied their basket they decide they want something else, add that to cart and go through the checkout again. This time when they get to PayPal, it seems to have added the previous shipment amount to the new shipment amount they have selected (Basically they get charged shipping twice?).
What we can't figure out is how/where the previous shipment is appearing from? As you can see we clear the shipments on emptying the cart? As soon as they order is successfully completed, its all reset and works correctly?
Hope that makes sense... As I say its a specific scenario, but an annoying one as we have no idea why its doubling up the shipment.
The shipment is created against their order and will remain in place even if you empty the basket (as a basket is just a state of the purchase order).
Is there any reason you're not using the built in Shipment methods which you can use to replace any existing shipments?
I thought I had deleted this! lol
Please ignore, figured out why it was behaving this way in the end. Thanks for replaying though :)
:) no worries although I would still recommend using the build in API methods where possible as it does a fair amount of work for you.
We are using the build in API method chap? We have just wrapped up all the UCommerce objects into our domain objects, and wrapped up the API methods into our own interfaced service/repos.
This way, in theory we could rip out uCommerce and replace it with a different ecommerce platform or our own custom one.
is working on a reply...