ShopifySharp
ShopifySharp copied to clipboard
api doesnt hae any way to set Inventory Item and cost per variant
ProductVariant object is missing InventoryItem property, so no way to set cost for variant. InventoryService only have Update,Get and List functions.
If I add new InventoryItem object, it does add the inventory but still doesn't set the cost for the product variant.
Also any idea how to get ProductMetaFields and ProductVariantMetaFields?
Hi, the InventoryLevel and InventoryItem can be a little confusing. Here is an image from the Shopify API documentation, explaining the relationship

ProductVariant object is missing InventoryItem property, so no way to set cost for variant. InventoryService only have Update,Get and List functions.
You have to use the inventory_item_id from the product variant, to update the cost. Example: https://shopify.dev/api/examples/product-inventory
If I add new InventoryItem object, it does add the inventory but still doesn't set the cost for the product variant.
You need to use the InventoryLevel to set the available quantity,