我最近在Commercetools平台上工作,我有一个问题。
如何获取某些特定购物车的CartDiscounts?现在,我有了通过ID获取购物车的方法,我想从购物车中获取所有CartDiscount。我该怎么做?还是CartDiscount适用于所有购物车,我可以做类似CartDiscountsQuery.of()的事情吗?
答案 0 :(得分:1)
折扣存储在订单项,自定义订单项和购物车的运输方式上。
对于运输方式,您可以像这样获得折扣:
final Cart fetchedCart = client.executeBlocking(CartByIdGet.of(id));
final List<DiscountedLineItemPortion> includedDiscounts = fetchedCart.getShippingInfo().getDiscountedPrice().getIncludedDiscounts();
有关更多信息,请查阅API参考文档。 https://docs.commercetools.com/http-api-projects-carts.html#shippinginfo