Did object variation ordinal usage change?

I have an automation that uses a template item to copy and create new items with about a dozen item variations.

Previously the template item variations started with ordinal ‘0’ (zero) and incremented from there.
Recently, the ordinals on my template item changed to start with ordinal ‘1’ (one) and increment from there, so now rather than ordinals 0…11, I have ordinals 1…12.

The change may have been introduced by a bulk update I did through a dashboard export/import cycle, but the ordinal certainly was not a column in the file.

This breaks an assumption in the code about how variations are distinguished and ordered.

Is this an known/intentional change?
Should I adjust for ordinals starting at 1 from now on?


:wave: I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:

Additional Documentation

Build and Manage a Simple Inventory
Inventory API: How It Works
Design a Catalog

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.

Good question. Let me see if I find out why some of your recent ordinals now start a 1.

I’m not too sure why your ordinals may have shifted to start from 1 instead of 0. I would like to take a look to see what you mean.

Could I get your application id from Developer Dashboard. And an example of an older generated catalog id of an Item whose variations started with 0, and a new example catalog id of an Item that starts with 1.

Hi Lance,

Thanks for looking into this.

My application id is: sq0idp-MrGeoIOtRSw2FC1OnXk0HA

The catalog id of the template item I’m using is B7MDTZC27BQFHWBOW4QL6PGB.

Either because of a change on Square’s side, or as an artifact of my export/import activity, I can no longer find item variations with a starting ordinal of 0; everything that I know previously had an ordinal of ‘0’ is now ‘1’.

I do have some historical logs for a few items showing the starting ‘0’ ordinal, but I’m hoping you can trust that I’m not making this up. :slight_smile:

Let me know if you need else and I’ll try to respond quickly.


Thanks for the info. Taking a look around. Let me get back to you after I investigate.

So far, I have found that the ordinal increase happened at 2024-01-12T05:15:03.546Z. Still trying to dig into the why it happened though. There’s small signs that your theory about the bulk import/export might be right, but not sure. I am still investigating.

@tdgjrb I have checked with the team. They confirmed the cause was caused an import.

The team also noted the following best practice with ordinal:
the recommendation is to design their integrations to only take the relative position of ordinals into account, they are not an absolute position.
The lowest ordinal should appear in a list first and then ascending ordinal values after that.
EG: two variations with ordinal: 0 and ordinal: 1 should be represented the exact same as two variations with ordinal: -1000 and ordinal: 99999 (with no other ordinal values present between these integers)
Ordinals below zero are certainly possible.

This being said, you may need to adjust how your application use ordinals, since I believe different features and applications using Square could adjust the ordinals to those extreme ranges.

Thanks @Lance-Square for the explanation and clarification.

I guess I got lazy and thought I could hang my hat on the first value always being zero since that is what I observed in testing with items created through the dashboard.

I am also lazily relying on the ordinals incrementing by one, which has been the case so far, but I understand your explanation that values may not increase linearly like that.

I will rework my code to set an index variable rather than depending on the ordinal to be useful in the way I thought it was.

And just to clarify, it is OK if I set the ordinals on newly created items with variation ordinals starting at any number so long as the following variation ordinals are larger the preceding ones, correct?

Thanks again for the research and explanation.

Yes, that is the proper understanding, so long as your ordinals are in order from smallest to largest, the intervals can vary.