discountAutomaticActivate mutation with error "Automatic discount activation has failed."

discountAutomaticActivate mutation with error "Automatic discount activation has failed."

kylehkhk
Shopify Partner
5 1 2

I am using postman to call the graphql api mutation discountAutomaticActivate and trying to activate an automatic discount which is now expired. However, I have got an error.

Screenshot 2024-06-06 at 12.41.11 PM.png

My mutation is 100% following the documentation - https://shopify.dev/docs/api/admin-graphql/2024-01/mutations/discountAutomaticActivate

 

And below is my mutation query in postman:

mutation discountAutomaticActivate($id: ID!) {
  discountAutomaticActivate(id: $id) {
    automaticDiscountNode {
      automaticDiscount {
        ... on DiscountAutomaticBxgy {
          status
          startsAt
          endsAt
        }
      }
    }
    userErrors {
      field
      message
      code
      extraInfo
    }
  }
}

Variables:
{
"id": "gid://shopify/DiscountAutomaticNode/<my discount id>"
}

Screenshot 2024-06-06 at 12.37.42 PM.pngScreenshot 2024-06-06 at 12.38.53 PM.png

 

I have added the access token to the header and granted all of the scopes to this token, so I am pretty sure the permission is not the root cause.

 

The interesting thing is, with the same setting, the discountAutomaticDeactivate mutation works completely fine. But when I try to active the discount again with the discountAutomaticActivate mutation, it returns error.

 

Please help me with it, thank you so much!

Replies 4 (4)

Eric-HAN
Shopify Partner
106 15 9

Hi, there

 

May I ask what's  in your params,     

EricHAN_0-1718610381106.png

 

Follow your flow , there is no issue in my side. 

- Helpful? Please hit Like and mark it as a solution
Want to modify or custom changes on store? Let me help.
- Feel free to Email Me    Buy Me A Coffee
kylehkhk
Shopify Partner
5 1 2

Hello @Eric-HAN ,

 

I believe I have nothing in my params, do you have any in the tab?

 

Screenshot 2024-06-17 at 5.29.49 PM.png

Eric-HAN
Shopify Partner
106 15 9

nothing in my params either . Works for me . You regenerate this error every time?

- Helpful? Please hit Like and mark it as a solution
Want to modify or custom changes on store? Let me help.
- Feel free to Email Me    Buy Me A Coffee
kylehkhk
Shopify Partner
5 1 2

Yes, i can reproduce this error every time 😞