question

pradeep-27 avatar image
pradeep-27 asked Emily L answered

How we set variable Price type to Line item of order ?

I have created custom line item for order but I want to set its type as variable price item and also want to set some value for it (like 1.20 etc.). Can anyone help me how can I achieve this. I read clover documentation twice but didn't find solution.

Custom TendersLineItems
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.

outahere91 avatar image outahere91 commented ·

I have also been through the documentation and I cannot find anywhere that explains how to set the price of a line item that is variable price. Clover please provide some guidance.

0 Likes 0 ·

1 Answer

·
Emily L avatar image
Emily L answered

Inventory items include a "priceType" field while an order's line items do not. To include an item with a variable price in an order, first make sure your inventory item's "priceType" is set to "VARIABLE". When you add the line item to the order, you can specify the price. For example, if you're creating an atomic order, the request body would look something like this:

{
    "orderCart": {
        "lineItems": {
            "elements": [
                {
                    "item": {
                        "id": "{UUID for your variable price item}"
                    },
                    "price": 120
                }
            ]
        }
    }
}
10 |2000

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

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