DiscountAutomaticApp with recurringCycleLimit have no impact on discounts

Hey everyone.

We noticed a bug with discount created using DiscountAutomaticApp and API version 2025-04

When setting recurringCycleLimit = 0 and appliesOnSubscription = true the discount is still not applying to future orders.

it only applies to first subscription order.

Here is the first issue, when appliesOnSubscription is false, it’s still apply on subscription items in cart. We can prevent this in function code by checking at code level but there is no way we can apply subscription to future orders.

recurringCycleLimit = 0is supposed to do this but it’s not working.

Anyone find any solution for this?

Hey @hujjatnazari - thanks for reaching out. This does sound odd to me, happy to confirm expected behaviour with you here for sure. Would you be able to share the exact discountAutomaticAppCreate/Update mutation input and response (including userErrors) and the discount GID? If you’re also able to confirm whether you add a contract-level discount via subscriptionDraftDiscountAdd/Update that would be super helpful too, and if you do, could you also share the draft/contract GID and those mutation payloads/responses?

If you’re able to share one example with the first order ID where the discount applied, the related subscription contract ID, and the subsequent renewal order/invoice where it didn’t and any function logs we could use that to dig into this more deeply as well.

If it’s easier to set up a DM to share the info (for example if it contains any sensitive information), just let me know and I can set that up on my end here - hope this helps :slight_smile:

Just to add another possibility here. I’ve seen some subscription applications respect the recurringCycleLimit value, and others do not. What are you testing with @hujjatnazari ?

Hey @Alan_G !

Thanks for helping out. Please check below details for more information.

Here is my function for creating the discount

async createAutomatic({
    title,
    functionId,
    startsAt = new Date(),
    endsAt = null,
    metafields = [],
    appliesOnSubscription = true,
    recurringCycleLimit = 0,
    combinesWith = {
      orderDiscounts: false,
      productDiscounts: false,
      shippingDiscounts: false,
    },
  }) {
    const mutation = `#graphql
      mutation CreateAutomaticDiscount($discount: DiscountAutomaticAppInput!) {
        discountCreate: discountAutomaticAppCreate(automaticAppDiscount: $discount) {
          automaticAppDiscount {
            discountId
          }
          userErrors {
            code
            message
            field
          }
        }
      }`;

    const variables = {
      discount: {
        title,
        functionId,
        combinesWith,
        appliesOnSubscription,
        recurringCycleLimit: parseInt(recurringCycleLimit) || 0,
        startsAt,
        endsAt,
      },
    };

    const response = await this.admin.graphql(mutation, { variables });
    const { data: { discountCreate } } = await response.json();
    this.handleUserErrors(discountCreate.userErrors, "create automatic discount");

    const discountId = discountCreate.automaticAppDiscount.discountId;

    if (metafields.length > 0) {
      await this.setMetafields(discountId, metafields);
    }

    return discountCreate.automaticAppDiscount;
  }

The function create the discount successfully and no error. When I query that the created discount, here is what I get with graphQL

Query

query DiscountByID{
  discountNode(id: "gid://shopify/DiscountAutomaticNode/1274072694937"){
    id
		discount{
      ... on DiscountCodeApp{
        appliesOnSubscription
        appliesOnOneTimePurchase
      	appliesOncePerCustomer
      }
      
      ... on DiscountAutomaticApp{
          appliesOnSubscription
          appliesOnOneTimePurchase
        	recurringCycleLimit
      }
    }
    metafields(first: 10){
      nodes{
        key
        namespace
        value

			}
    }
  }
}

Result

{
  "data": {
    "discountNode": {
      "id": "gid://shopify/DiscountAutomaticNode/1274072694937",
      "discount": {
        "appliesOnSubscription": true,
        "appliesOnOneTimePurchase": true,
        "recurringCycleLimit": 0
      },
      "metafields": {
        "nodes": [
          {
            "key": "$app:function",
            "namespace": "app--154741309441--function-configuration",
            "value": "json data placeholder"
          }
        ]
      }
    }
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 8,
      "actualQueryCost": 5,
      "throttleStatus": {
        "maximumAvailable": 2000,
        "currentlyAvailable": 1995,
        "restoreRate": 100
      }
    }
  }
}

Hey @bkspace I’m using Shopify native subscription app for the subscription. I had a client who reported this and their customers are not getting discount in future orders despite having the options to recurringCycleLimit = 0

@Alan_G I’m not using subscriptionDraftDiscountAdd/Update

Not sure if you’ve access to my dev store but here is the first order with discount applied

https://admin.shopify.com/store/checkout-features-dev/orders/5982738743484

Here is the contract ID

https://admin.shopify.com/store/checkout-features-dev/apps/subscriptions-remix/app/contracts/30838128828

Thank you!

Thanks @hujjatnazari, appreciate you sending this our way. I’ll continue to do some digging into this on my end and loop back with you once I have next steps to share.

Hey @hujjatnazari - quick update here. We’ve done some investigation into this and are looking into this further as a potential issue on our end. I’ll keep eyes on this and update you as soong as I have next steps.

1 Like

Thank you @Alan_G

I’m also double checking this and let you know.

No worries @hujjatnazari, happy to dig into this and wanted to follow up here. We’re still looking into this, but out of curiosity, are you noticing if the issue is still present if you use API version 2025-07 or any older version before 2025-04? Just trying to isolate if it’s only an issue with a specific API version.

Hope to hear from you soon.

Hey @hujjatnazari - just wanted to follow up per the above? Hope to hear from you soon - thanks!

Hey @Alan_G

Thanks for following up on this. I was still testing a few subscription orders with weekly interval on API version 2025-04 and and it’s working fine for new subscriptions.

Not if Shopify updated something but it’s working now. The future orders are getting the discounts.

I’m actively testing this again and see what was causing this issue for some of our customers.

Thank you again for looking into this.

No worries @hujjatnazari , I’ll close out the thread for now, but if you do see the issue pop up again or would like us to look into this further, just ping me here and I’ll take a look :slight_smile: