question

robsmitha avatar image
robsmitha asked robsmitha commented

Why does LineItem name property display as the Inventory name property

Using the /v3/merchants/{MerchantId}/orders/{OrderId}/line_items endpoint to add a single line item to an order with a custom line item name. I create the LineItem object and pass it to the endpoint, but when I read the lineItem again after loading the order with the lineItems expansion, I get the Inventory item name.

Please let me know if you can offer any insight on this issue. Thanks.
InventoryLineItems
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brokenoval avatar image
brokenoval answered robsmitha commented
The Order and Inventory resources are distinct database tables. Every time you see "line_items" in the API it is essentially a reference to the Inventory table via a join. So if you're posting to the order/{orderId}/line_item object it should be joining, but my suspicion is that the join doesn't really work that way for a subquery.

What you should look at doing it directly writing to the PUT /v3/merchants/{merchantId}/lineItems/{lineItemId} API instead and I think you'll have more success overwriting the inventory.

If you're only looking to do this as a once off and not change the underlying inventory I'd recommend possibly looking at overwriting a different field rather than the name e.g. the "tag" or "alternat name" fields.
1 comment
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

robsmitha avatar image robsmitha commented ·

Thanks for the response, ended up making a custom class in my application that will set the item name dynamically from our database rather than using the line item name.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community