I am adding some custom line item to order . I need to add some custom modifier to recognize item later. When i m adding modifier with line item id and order id i am getting status code 400 error.
I am adding some custom line item to order . I need to add some custom modifier to recognize item later. When i m adding modifier with line item id and order id i am getting status code 400 error.
Hi,
Will you provide the request URI + request body? A screenshot from a REST API client like Postman would be helpful.
Hii I am using android SDK and using following code snippet :-
LineItem lineItem= mOrderConnector.addCustomLineItem(orderId, mItem, false); Modifier modifier= new Modifier(); modifier.setName("Demo"); mOrderConnector.addLineItemModification(orderId, lineitem.getId(), modifier);
Hi @Nirmal,
A Modifier
is associated with an Item
, and a Modification
is associated with a LineItem
. Looks like you're instantiating a Modifier
and trying to associate it with a LineItem
. Let me know if this information helps you resolve the issue.
I believe that the modification that you add to a line item has to be a proper modifier in the merchant's inventor (can't make a one-off custom modification). Try adding a modifier with the uuid provided by InventoryConnector#getModifierGroups(...) and InventoryConnector.getModifiers(...).
Alternatively, could use InventoryConnector#createModifierGroup(...) and InventoryConnector#createModifier(...), and once it is persisted to the database you can get the proper modifier uuid and then should be able to add it to the order (don't actually do this for each order though).
Keep in mind that you'll need to modifier.setPrice()
to be able to persist it to the db - it looks like in your example code @Nirmal that a price was not set. Price is a required property for a Modifier.
No one has followed this question yet.