question

demskigroup avatar image
demskigroup asked ·

Adding a Modifier to a LineItem Via SDK

I am having some issues adding a modifier to a line item via the sdk. I can add the line item to an order through the sdk no issue but then I have tried using the orderconnector.addLineItemModification and all I keep getting is ClientException error. My current process is using orderconnector.addVariablePriceLineItem to add the line item to the order which works great but then using orderconnector.addLineItemModification gives me an error. Is there a different method I should be doing this?

Orders
10 |2000 characters needed characters left characters exceeded

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

demskigroup avatar image
demskigroup answered ·

Do I have to add the modification to the lineitem before adding it to the order? Or can I add the lineitem to the order and then add the modification?

Share
10 |2000 characters needed characters left characters exceeded

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

Bejoy Nair avatar image
Bejoy Nair answered ·

You have to use the same method for adding the modifiers to line items using sdk. you need to provide following parameters to the method:-

orderConnector.addLineItemModification(orderId, LineItemId, modificationObject);

By using this you should be able to to add a modification to lineitems.

For adding Line Items to Order there are 3 methods available. You need to choose one of them based on the price type of that Lineitem:-

  1. If the price type is "FIXED" then use addFixedPriceLineItem()

  2. If the price type is "VARIABLE" then use addVariablePriceLineItem()

  3. If the price type is "PER_UNIT" then use addPerUnitLineItem()

2 comments Share
10 |2000 characters needed characters left characters exceeded

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

Do I need to add the modifcation to the lineitem before adding it to the order? Or can I add the lineitem and then add the modification?

0 Likes 0 · ·

There are 3 steps to add Order:-

  1. Create an Order in Clover.

  2. Add a Line Item to an Order using the OrderId

  3. Add a modification to a Line Item using the LineItem id and Order Id.

0 Likes 0 · ·

Welcome to the
Clover Developer Community