outspoken
outspoken

Reputation: 75

BigCommerce API PHP createOrder => product options

I am attempting to create an order via the API into bigCommerce. I can successfully create an order containing either a new product, or an existing product.

My current issue is in dealing with the product options... I am attempting to create an order containing a large t-shirt

My setup is like this: parent item is: black t-shirt 1. contains an option set: mySizes 2. contains skus for: small medium large

this is the products portion of the array that I am sending:

[products] => Array
    (
        [0] => Array
            (
                [product_id] => 30 //(parent ID)
                [quantity] => 1
                [product_options] => Array
                    (
                        [0] => Array
                            (
                                [id] => 18 //(option_id:size)
                                [value] => 74 //(id for value:large)
                            )
                    )
            )
    )

I have not found proper documentation as to what [id] and [value] are to be used here. I have tried a number if different combinations with no luck.

thanks in advance for your assistance.

Upvotes: 1

Views: 496

Answers (1)

Monica O.
Monica O.

Reputation: 326

The field [id] represents the product_option "id" field in the Product Option Resource from the bigcommerce API documentation link below:

https://developer.bigcommerce.com/api/objects/v2/product_option

The field [value] represents the "option value" id field, as you said, you are correct...in the Option Values Resource from the bigcommerce API link below:

https://developer.bigcommerce.com/api/objects/v2/option_value

Upvotes: 1

Related Questions