How to detect the usage of an AutomaticDiscountBxgy on an Order?

tolgapaksoy
Shopify Partner
73 5 40

I'm using 2021-04 Admin Graphql API.

How do I detect the usage of an Automatic bxgy discount when I fetch an Order? What difference does the discountApplication have from a FixedFee or Percentage automatic disocunt?

0 Likes
tolgapaksoy
Shopify Partner
73 5 40

This is the type in the docs:

https://shopify.dev/api/admin/graphql/reference/orders/automaticdiscountapplication

 

allocationMethod: DiscountApplicationAllocationMethod!
The method by which the discount's value is allocated to its entitled items.

index: Int!
An ordered index that can be used to identify the discount application and indicate the precedence of the discount application for calculations.

targetSelection: DiscountApplicationTargetSelection!
How the discount amount is distributed on the discounted lines.

targetType: DiscountApplicationTargetType!
Whether the discount is applied on line items or shipping lines.

title: String!
The title of the discount application.

value: PricingValue!
The value of the discount application.

 

Given these fields on AutomaticDiscountApplication, I can only fetch the "effects" of the discount: how much percent or how many € the discount had effect on this order. What I would like to know is whether the AutomaticDiscountApplication was caused by a Buy-X-Get-Y price rule.

Any Shopify dev, or Shopify App dev every tried to do this?

My use case is simple: I am building an app that needs to map discount usage to some external ERP system. One of the mappings that I need to do is whether a BxGy percent or a BxGy fixed discount was used.

0 Likes