1

Adding a product to a customer's cart via the REST API is easy enough. However, in our case we also want to add additional info_buyRequest options. But the documentation isn't really clear on how to add more buy request attributes for such a request.

We tried with

{
    "cartItem": {
        "sku": "243612",
        "qty": 1.0,
        "quote_id": "23627",
        "product_option": {
            "info_buyRequest": {
                "foo": "foobar"
            }
        }
    }
}

but had no luck with that. Is there any way to do that?

Magento Version: 2.3.2

1 Answer 1

0
{
    "cartItem": {
        "sku": "243612",
        "qty": 1.0,
        "quote_id": "23627",
        "product_option": {
              "extension_attributes": {
                "custom_options": [
                    {
                        "option_id": "foo",
                        "option_value": "bar"
                    }
                ]
            }
        }
    }
}
3
  • And this really will be in info_buyRequest?
    – fritzmg
    Dec 11, 2019 at 17:13
  • I think, you can see it in quote_item_option table
    – angel
    Dec 12, 2019 at 12:09
  • Unfortunately that does not work. These custom options will just live under the options key within info_buyRequest.
    – fritzmg
    May 24, 2022 at 9:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.