Skip to content

When using AddProduct with a productSnapshot, the prices are all zero. #717

@redmorello

Description

@redmorello

Which component is this issue related to?

Umbraco Commerce (Core)

Which Umbraco Commerce version are you using? (Please write the exact version, example: 10.1.0)

13.2.3

Bug summary

We are fetching our prices from an external service and have implemented this using a CustomProductAdapter & CustomProductSnapshot

We allow anyone to add a product to the cart, but only logged in users can see prices, so when the user first adds a product to the cart, we add using AddProduct, but the snapshot will have a zero price, as they are not logged in.

Once the user logs in, we are then trying to replace any orderlines that have a zero prices, with a product snapshot that has an actual price., as you can't directly modify the prices on the orderline.

We are doing this by looping over the order.OrderLines and removing any with a zero prices, copying the details into a new AddProduct call with a new snapshot. I can see the valid prices in the snapshot before we call AddProduct.

Once AddProduct is called, but before we call either:
_umbracoCommerceApi.SaveOrder(order);
uow.Complete();

I can see that the orderline has got a zero price again.

Specifics

No response

Steps to reproduce

I'm not sure you can!!

Expected result / actual result

I'd expect that AddProduct with a valid snapshot would have valid prices.

Dependencies

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions