ChannelApe / shopify-sdk

Java SDK for Shopify REST APIs
Apache License 2.0
166 stars 112 forks source link

I want to change the inventory #118

Closed whoamizq closed 1 year ago

whoamizq commented 1 year ago

But using this method didn't work? shopifySdk.updateVariant() image

ryankazokas commented 1 year ago

Yea, this was how inventory quantities used to be changed prior to shopify's changes with multi inventory setups.

Now you have to use the updateInventoryLevel method if you want to update inventory. You should be able to pull the inventory item id off of the variant to make that call.

public ShopifyInventoryLevel updateInventoryLevel(final String inventoryItemId, final String locationId,
            final long quantity)

I'll leave this open so we can mark that available inventory on the variant as deprecated to avoid the confusion.

dimaloop commented 1 year ago

Is there are any way to GET variant's inventory item levels?

ryankazokas commented 1 year ago

When you do a GET to a variant

getVariant(final String variantId)

The inventory level is an aggregate of the levels across all locations.

As for this endpoint , we do not have that functionality yet built in to the sdk.