What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: automatic discount code usage count not incrementing

Solved

automatic discount code usage count not incrementing

ravimobifyi
Shopify Partner
8 1 0

I am creating order using order post API. I am using automatic discount and I can see discount amount reduced on order page in admin. Discount is successfully getting applied on order. Here the problem is automatic  discount usage count is not incrementing after order post api. I waited few hours but still it has not updated. 

 

"discount_codes": [
{'code': '20RSOFFONALLSHOES', 'amount': '20', 'type': 'fixed_amount'}
]

 

 

 

 

Screenshot 2021-06-14 173358.png 

Accepted Solution (1)

GrahamS
Shopify Staff (Retired)
193 37 55

This is an accepted solution.

Hello @ravimobifyi ,

This would be an expected outcome for an order generated via orders API. As it stands, when creating your order, the discount fields include no option for citing a Price Rule ID, which would be necessary in order to associate your order discount with the discount you have configured in the admin. Because of this, submitting a discount through the API will always be interpreted as a custom line item discount, even if it shares the same name and value as a discount that you have created in the admin. 

For the moment, the tally will only increment for uses that come through the Shopify Checkout, rather than including API based usages.

To learn more visit the Shopify Help Center or the Community Blog.

View solution in original post

Reply 1 (1)

GrahamS
Shopify Staff (Retired)
193 37 55

This is an accepted solution.

Hello @ravimobifyi ,

This would be an expected outcome for an order generated via orders API. As it stands, when creating your order, the discount fields include no option for citing a Price Rule ID, which would be necessary in order to associate your order discount with the discount you have configured in the admin. Because of this, submitting a discount through the API will always be interpreted as a custom line item discount, even if it shares the same name and value as a discount that you have created in the admin. 

For the moment, the tally will only increment for uses that come through the Shopify Checkout, rather than including API based usages.

To learn more visit the Shopify Help Center or the Community Blog.