productVariantsBulkCreate deletes default title variant even when using default behaviour

Hey @rafaelsorto and all :waving_hand: I really appreciate your feedback here and I do agree that we can improve this behaviour. I can’t say for sure what a fix or implementation would look like, but I’ve reached out to our product team and I did just want to confirm that we are looking into this at a code-level on our end.

I’ll keep my eyes on this for you and the rest of the folks in the thread and loop with you as soon as I can confirm a fix or share more info. Thanks again for flagging this :slight_smile:

1 Like

Thank so much @Alan_G . In our case, per this thread: Urgent: Product GraphQL API bug? Suddenly getting "Variable $input of type ProductVariantInput! was provided invalid value for inventoryItem.sku (Field is not defined on InventoryItemInput)"

One of the endpoints in 2024-07 that we rely on broke in the last 48 hours and apparently won’t be fixed, so it’s time sensitive for us to find a resolution for this specific default variant behavior in 2024-10 that doesn’t involve an unreliable workaround.

Hey folks, thanks for your patience on this. I see how we don’t have your case handled in the graphql API. The docs are incorrect and we’re going to correct them asap.

For this case, we’d like to introduce a new strategy rather than change the default behavior. This became the default because the most common case is creating a product then adding in options/variants while deleting the default variant.

We’re thinking of a PRESERVE_STANDALONE_VARIANT strategy. So that would leave us with:

argument: strategy
The strategy defines which behavior the mutation should observe when handling "standalone variants", such as whether to keep or delete the standalone variant (when product has only a single custom or default variant).

`DEFAULT` The default strategy; deletes the original default ("Default Title") variant when it's the only variant on the product. Standalone custom variants are preserved.

`REMOVE_STANDALONE_VARIANT` Deletes the existing variant when it's the only variant on a product. This applies to both the default ("Default Title") variant and single custom variants.

`PRESERVE_STANDALONE_VARIANT` Preserves variants in both standalone variant cases, the default ("Default Title") variant or a custom variant. The original variant is kept alongside any newly created variants.

Please let us know if the PRESERVE_STANDALONE_VARIANT strategy doesn’t meet your app’s needs. Any feedback is welcome.

1 Like

Hey @Tim-Shopify, thank you for the proposed solution, this will work amazingly well on my company’s app and it was right what we expected from the default strategy, again, thank you for the turnaround on this :slight_smile:

Same here, having a new Strategy that preserves the Default Title variant works for us, even if it creates a new option with Title and we specify a value for the default option.

Thanks!

@Tim-Shopify thank you, that works for us. Any idea of timing? And to confirm this will be available starting in 2024-10?

@derrick it would be in the latest RC version - so that’s 2025-10. If you’re unable to migrate forward, is there anything preventing you from using the previously mentioned productOptionCreate approach?

Similar to @rafaelsorto - check if there is only the Default Title variant. If so, there are a couple of options:

1 - productOptionBulkCreate w/ LEAVE_AS_IS strategy (note: you’ll need to update the “Default Title” name by calling something like values: [{name: "default"}, ...]") followed by productVariantBulkCreate with your new variants data

2 - productOptionBulkCreate w/ CREATE strategy followed by productVariantBulkUpdate using the ID for the new variant you created

1 Like

Hey folks,

This recent update should improve the experience:

1 Like