question

dhanaraj avatar image
dhanaraj asked zgreathouse Deactivated answered

How to get modifiers list against single line item using clover sdk

While placing an order need to add the modifiers against a single line item through clover SDK. so we couldn't get the modifers list in inventory connector
Inventory
10 |2000

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

zgreathouse avatar image
zgreathouse Deactivated answered
If your goal is to get all the Modifiers for a single Item, you can still do so using the Inventory connector. To get all the Modifiers for a single Item, you can use the Item class's getModifierGroups method to get a list of the Modifier Groups the Item belongs to. You can then use the Modifier class's getModifiers() method to get all the individual Modifiers within a Modifier Group.

//This is an example of how to get all the Modifiers for the first Modifier 
//Group the item belongs to.
item.getModifierGroups().get(0).getModifiers();
10 |2000

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

zgreathouse avatar image
zgreathouse Deactivated answered
Line Items belong to an Order, so you want to utilize the Order Connector to work with Line Items. Within the Order Connector there is a LineItem Class with a setModifications method among many other methods.
10 |2000

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