The number of items I have is under 200.
But, if the code like below is executed,
variable: items would be huge number(≒endless loop),
and ,items are overlapped many times.
That array involve multiple :version of catalog_objects.
How can I get uniq and all item objects?
Please,help me.
(It suppose that the variables:client. location_id have been declered)
items=[]
cursor=nil
loop do
result = client.catalog.search_catalog_items(
body: {
enabled_location_ids: [location_id],
cursor: cursor,
sort_order: "ASC",
product_types: ["REGULAR"]
}
)
if result.success?
items.concat(result.body.items)
break if result.cursor.nil?
cursor = result.cursor
elsif result.error?
raise result.errors
end
end