d
Topic
Ryan O Shopify Employee
Posts:
233
2 months ago

Upcoming change to ProductVariants default parameters

Hey all,

When creating a new ProductVariant, there are going to be some changes to the defaults when not specified.

  • inventory_quantity now defaults to 0
  • inventory_management now defaults to shopify

The change to inventory_quantity is live, the change to inventory_management will come next week.  Please respond with any comments or questions.

Cheers,

Shopify Apps Team

i
Replies
Maris Shopify Partner excelify.io
Posts:
277
Last edited 2 months ago

Awesome, Ryan!

Thanks for this change, it's very valuable for Excelify customers!
Actually, I noticed that this change was already functioning a couple of days ago, or was I mistaken?

Around this topic there is one strangeness however - when setting the inventory quantity (also through levels), if inventory_management is not "shopify", API wouldn't allow to set the quantity. But in reality that quantity might be already set to something.

Some time ago API allowed to set the quantity regardless of what the inventory_management is, but now it can't.

So in Excelify app context - if the user exports all variants with their quantities, they can't just import them back, because in some cases API will tell that you can't set the inventory because you don't have the inventory_management set to "shopify". I am working around that issue but still, you might think about that aspect.

The biggest issues of all is that with new multi-level inventory it got so slow to create Products with Variants. Products which we could create earlier in 0.25 seconds, now take 6 seconds if there are many variants with inventory. No REST API, no GraphQL API can solve this so far - because in either case we need to run as many requests as there are variants. Any improvements in that area would be totally awesome.

Overall - can feel and appreciate improvements happening, thanks for those!

Maris
Excelify.io

Excelify.io | Bulk Import Export Update with Excel | https://apps.shopify.com/excel-export-import | https://excelify.io
Ryan O Shopify Employee
Posts:
233
2 months ago
g
1
upvotes

Hi Maris,

The change to the default inventory_quantity is already in yes. The inventory_management will go live next week.

inventory_management can also be set to a fulfillment service, so it's not only able to be set as shopify.

I understand the frustration with with the new product creation, the unfortunate fact is that as the models get more complicated, it will likely slow down.  However we are always working to speed things up on our end.

 

Cheers,

Matt Burton Member
Posts:
4
about 2 months ago

Ryan -

Currently we create variants that don't have inventory levels (i.e. made on demand goods) with the inventory_management value set to an empty string in order to have them set to "Don't track inventory" - will that still be an option or is that going away? I don't see that called out in the docs as an option either. If it's still going to be an option what should we need to send as the value?

Thanks,
Matt

Ryan O Shopify Employee
Posts:
233
about 2 months ago

Hi Matt,

To maintain that behaviour you should be passing null as the inventory_management to be explicit that you do not want inventory tracked.

 

 

 

Matt Burton Member
Posts:
4
about 2 months ago

Ryan -

Good deal - I'll make that adjustment - thanks!

- Matt

Ryan O Shopify Employee
Posts:
233
about 2 months ago

The change to inventory_management will be shipping early this week!

nata502ly Member
Posts:
7
about 2 months ago

Hi, Ryan! I need to update product quantity with API, how can I do it now? with previous request I get 422 error b'{"errors":{"base":["Write requests to inventory_quantity and inventory_quantity_adjustment are no longer supported. Please use the Inventory Levels API."]}}'

Ryan O Shopify Employee
Posts:
233
about 2 months ago
George Member
Posts:
11
Last edited about 2 months ago

Is there a way to set the inventory during creation of the product variant rather than having to make subsequent calls to the inventory APIs?  Right now if we're creating a decent number of variants, we now have to double the calls to make them available.  In addition, if we 're-upload' them.. essentially and update, the inventory gets zero'd out and we have to reset them all over again.

 

By the way, we are passing null (or not passing at all) inventory_management and it's still zeroing the inventory levels out and making the item unavailable.

Ryan O Shopify Employee
Posts:
233
about 2 months ago

You can set inventory upon product creation only by using the GraphQL Admin API.  You cannot do this in REST any more unfortunately.

George Member
Posts:
11
Last edited about 2 months ago

Well.. fiddle.  I'd love to understand how to basically make our items not-inventoried.. my only solve right now is to set the inventory to a rather gigantic number.  

 

I've tried when creating the variant to set inventory_policy = "continue", but that doesn't seem to work either.. once inventory is zero, product is unavailable.

Ryan O Shopify Employee
Posts:
233
Last edited about 2 months ago

Hey George,

It should simply be "inventory_management": null to not track inventory on product create.

 

{
  "product": {
    "title": "Test product no inventory",
    "inventory_management": null
  }
}

The above works for me testing in Postman

George Member
Posts:
11
about 2 months ago

Documentation doesn't specify inventory_management as part of product creation.  I'll give it a whirl!

Ryan O Shopify Employee
Posts:
233
about 2 months ago

It's not required, but you can specify such as above.

Cheers.

George Member
Posts:
11
about 2 months ago

Well, unfortunately, that didn't work.. here's snippet of the PUT that we're sending to 

"/admin/products/" + shopifyProductId + ".json"

ShopifyProduct(id=1491154665551, title=New Product, handle=New Product, vendor=GearLaunch, fulfillment_service=GearLaunch, body_html=null, product_type=Apparel, inventory_management=null, variants=...

It resets the inventory levels to 0 and .. tadah, angry customers.  Sigh.

George Member
Posts:
11
Last edited about 2 months ago

I just tried a new product.. setting it from the start.  Creating a new product works fine (always has actually). However as soon as we 'update' the product (resync with the PUT), even though inventory_management is still null, we get a 0 inventory and the item is out of stock.

 

 

 

Screen shot 2018 10 19 at 12.44.06 thumb
Ryan O Shopify Employee
Posts:
233
about 2 months ago

If you provide a request-ID I can look into it.  I do see products on that shop with inventory_management: null and no quantity created successfully.

George Member
Posts:
11
about 2 months ago

Yep.. again, creating them works fine.  Updating (the PUT call to "/admin/products/" + shopifyProductId + ".json") is what seems to shoot us in the head.  

Ryan O Shopify Employee
Posts:
233
about 2 months ago
g
1
upvotes

you probably are trying to update the product instead of the product variant to "inventory_management": null

George Member
Posts:
11
about 2 months ago

Sorry, I thought that's what you were telling me to do.  I'll try the product variant instead.

George Member
Posts:
11
about 2 months ago

holy cow that worked.. THANKS!!!!

nata502ly Member
Posts:
7
about 2 months ago

 Ryan, please help with request to update product quantity, can't find it on documentation.

Before changes I have used request:

payload = {
                    "variant": {
                    "id":''' + str(promotion_inventory_id) + ''',
                    "inventory_policy":'''+'"'+inventory_policy+'"'+''', 
                    "inventory_management": "shopify",
                    "inventory_quantity":'''+ str(n) + '''
                          }
              }
        response = request.put(
            'https://' + shopify_store + '.myshopify.com/admin/variants/' + str(promotion_inventory_id) + ".json", json=payload)

 

 

 

 

Posts:
3
about 2 months ago

HI Ryan,

We have a fulfillment app that was working fine until the past few days, however now it won't return fulfillment tracking numbers and PDF labels to our app in Shopify stores.  I'm not sure if this has anything to do with the inventory_management change defaulting to 'shopify' now?  I think previously we had it as 'Manual'.  Would this matter and should we change it to shopify to have fulfillment data get returned correctly to the app and shopify stores?

Thank you.

Steve