[BUG] Subscriptions with deleted products get inconsistent INSUFFICIENT_INVENTORY billing failures

As of API version 2024-07 with the new behavior of failing billing attempts with the INSUFFICIENT_INVENTORY error code there’s a pretty big bug:

If you create a subscription contract with one line, then delete the variant on that line, then try to create a billing attempt the attempt fails with the INSUFFICIENT_INVENTORY error code.

BUT if you create a subscription contract with two lines, then delete the variant from only one of those lines, then try to create a billing attempt it succeeds and an order is created with two lines (the deleted and non-deleted variant).

This is very easy to replicate using the steps mentioned above. Here are a couple subscription IDs and billing attempt IDs that you can view to see this issue:

Subscription with one line, who’s variant has been deleted and the failed billing attempt with the INSUFFICIENT_INVENTORY error code:

  • gid://shopify/SubscriptionContract/23059956014
  • gid://shopify/SubscriptionBillingAttempt/48885793070

Subscription with two lines, one of which has a deleted variant (same as the first subscription’s line) and one non-deleted variant and the successful billing attempt:

  • gid://shopify/SubscriptionContract/23059988782
  • gid://shopify/SubscriptionBillingAttempt/48885596462

This is a pretty big problem since the change in 2024-07 to respect inventory. It’s causing a lot of billings to not go through. This didn’t used to be a problem for deleted variants. And since the variant is deleted, there’s no way for the merchant to increase the inventory.


I’m really realllly hoping that the bug is that deleted variants shouldn’t trigger this error because merchants very frequently delete variants even when they don’t think they are deleting variants. If a merchant creates a product but doesn’t add options to the product and then sells it on subscriptions with the default variant (merchants don’t even know that there is a default variant). Then if they add options even if they’re only going to have a single variant that they want to add more context to, Shopify deletes the default variant which puts all the existing subscriptions in this situation where they’ll never be able to bill again (unless the subscription has non-deleted products too). There are many situations like this where a merchant is deleting variants and not realizing it… and merchants often delete variants without giving it much though even though they’ve sold subscriptions to it.


I’m hoping somebody can identify this as a bug in the 2024-07 version and fix it quickly as its impacting all merchants on all subscription apps.


Thanks in advance!

Hi @Brian_Singer,

Thank you for reporting this issue and all the detail provided. I have investigated this and can confirm I can replicate the issue.

We’re working on a fix for this which I hope to release in the next few days.

I can also confirm the other issue you reported will be resolved as part of the same fix.

Many thanks,

Paul

1 Like

Thanks Paul!

Do you know if the fix is going to allow orders to be created with deleted products again (even if it’s a solo deleted item)?

Brian Singer

Hi @Brian_Singer,

Yes that’s correct, the original behaviour of allowing subscription contracts with deleted variants to create orders will be restored.

The fix for this should be released today.

Best wishes,

Paul

1 Like

Hi @Brian_Singer,

We’ve released a fix for this now. Please let us know if you still see any issues around deleted variants and insufficient inventory errors.

Thanks again for reporting the issue.

Best wishes,

Paul

1 Like

We do see that it’s working as expected now @Paul-Springett - thank you!

We are seeing a new (possibly related) issue though. Reported it here: [BUG?] `INSUFFICIENT_INVENTORY` error code given but error message refers to missing/disabled inventory location