question

wsadiq avatar image
wsadiq asked Mark Mullan Deactivated commented

How to get quantity of a line order item using SDK

Hello,

I am using the SDK on clover and trying to figure out how to get the quantity. I have an item in the inventory configured as price/unit. I ring up 2 or 3 units of that item. When I get the order in my code and iterate over its line items, I cannot seem to find a way to get the quantity of number of units being sold. I am eventually trying to get the total of that line item but can't find it. I either need the total for that linen item or need the quantity of that line item, I already have the unit price so if I have the quantity, I get the line item total.

Please advise.

Waqar

3 comments
10 |2000

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

Mark Mullan avatar image Mark Mullan commented ·

Hi Waqar,

It's not clear to me how this issue pertains to the Clover SDK or our REST APIs... would you mind sharing some code snippets? I can try to help you from there.

Thanks,

Mark

0 Likes 0 ·
wsadiq avatar image wsadiq commented ·

Hi Mark,

I tried to put a code snippet but ran out of space quickly. But to clarify, I am talking about Clover SDK.

0 Likes 0 ·
jim-patel avatar image jim-patel commented ·

You can put the code on pastebin or similar and link to it.

0 Likes 0 ·

1 Answer

Dan avatar image
Dan answered wsadiq commented

lineItem.getUnitQty() should return a long representation of the unit quantity. Note that 1 unit corresponds to a unit quantity of 1000 (and 0.001 units to 1 unit quantity).

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.

wsadiq avatar image wsadiq commented ·

This does it. Thanks.

0 Likes 0 ·

Welcome to the
Clover Developer Community