Discount class for auto discount

Background

I have a function-controlled auto discount, handling both order and product based discount. Recently it failed to combine with discount codes, due to the auto discount being treated as order discount class even when no order discount is being issued.

Therefore want to confirm if the discount class of a function-controlled auto discount, is controlled by “whether orderDiscountsAdd object is presented”, or “whether an actual candidate is included in candidates”?

Case

Discount code

  • order discount
  • set to allow combineWith product discounts

Auto discount

  • set to allow combineWith product and order discounts
  • orderDiscountsAdd: empty candidates, selectionStrategy = Maximum
  • productDiscountsAdd: have value for candidates

Based on Discount API doc, this auto discount should be treated as product discount class, thus allowing the combination.

Discount classes are assigned based on their associated Discount Function targets: OrderDiscountCandidateTarget, ProductDiscountCandidateTarget, and DeliveryDiscountCandidateTarget.

In actual use case, this auto discount is also treated a order discount class, which is not expected. This is confirmed by allowing order combineWith in discount code, the two discount successfully combine.

The combination was working until last week, so may I know if the logic regarding discount classes was updated since then?

Thanks in advance.

Hi @Mantis, when you created the discounts, how did you define discountClasses? Did your auto discount only have PRODUCT?

Hi @Paige-Shopify, my auto discount cover both PRODUCT and ORDER. When calling discountAutomaticAppCreate, the input is:

discountClasses: [ ORDER, PRODUCT ]

So the default discount classes should have both type.

But for the affected case, only PRODUCT discount are being granted, so only ProductDiscountCandidateTarget exist.