How to fixed the {variant_id: [{code: “invalid”, message: “is invalid”, options: []} in php

aahh … ok.

First off; I’d highly suggest you move to GraphQL. The REST API’s are going to all be phased out; and even now some of them are breaking more and more. You should move to GraphQL as soon as possible (meaning, like tomorrow … seriously)

Second: You need a bit more info in your line item. I’d assume that you’re getting that error because you’ve left out quite a bit of the information. I could be wrong - but I’m willing to bet filling that out just a bit more would do the trick. This IS a required field after all.
Let me know how it works out :slight_smile:

"line_items": [
  {
    "compare_at_price": "9.99",
    "fulfillment_service": "manual",
    "grams": "20",
    "id": 39072856,
    "line_price": "19.99",
    "price": "19.99",
    "product_id": 632910392,
    "quantity": "",
    "requires_shipping": false,
    "sku": "IPOD2008GREEN",
    "taxable": true,
    "title": "IPod Nano - 8GB",
    "variant_id": 39072856,
    "variant_title": "Green",
    "vendor": "Apple"
  }
]