Development discussions around Shopify APIs
I understand in the Shopify api a product will always have 1 variant even if the end user doesn't setup variations in the admin panel. I need to be able to detect if the product coming back from rest API has 1 real variation OR just the default variation (used when a product does NOT have any variations)
What I am doing now is
//if we have more than 1 variation I know it is using real variations...But if an end user sets up a product with 1 variation I want to detect that also. So I check the title field NOT being Default Title
if (count($result['product']['variants']) > 1 || $result['product']['variants'][0]['title'] != 'Default Title')
This feels really hacky; but there isn't a field in the product rest api I can use.
yes.. I have the same problem. I am not sure if the words "Default Title" also works in other locations/languages. I mean, has a Chinese store the same "Default Title" for the default variation?. Not sure of this...
Were you able to find a better solution?
Thanks in advance!
Does anybody have the answer to this question?
User | RANK |
---|---|
19 | |
7 | |
7 | |
6 | |
5 |
Learn these 5 things I had to learn the hard way with starting and running my own business
By Kitana Jan 27, 2023Would you love to unleash the unbridled power of the Google Shopping Channel into your sho...
By Gabe Jan 6, 2023How can you turn a hobby into a career? That’s what Emmanuel did while working as a wa...
By Skye Dec 30, 2022