bigcommerce - Add products to Cart using cart.php in Big Commerce -


i trying add product cart using http post in remote.php like

post /cart.php http/1.1 host: mobfirst.mybigcommerce.com cache-control: no-cache content-type: application/x-www-form-urlencoded  action=add&product_id=35&variation_id=currency_id=&attribute[66]=11&qty[]=1 

it works, wonder know how figure out number of attribute corresponding option product (66 in attibute[]). saw dynamic.

ps: can't use api create order because don't have billing address @ moment.

answer of support:

i did not know of way find attribute number other scraping product page. digging , testing things though have found comes from.

it appears attribute number comes "product option id" number can pull api (not confused "option id" number). easiest way explain example, wanted find attribute numbers product id 50. make request to:

https://domain.com/api/v2/products/50/options

this give me list of "product option" objects similar this:

[  {  "id": 199,  "option_id": 75,  "display_name": "option 1",  "sort_order": 0,  "is_required": true  },  {  "id": 200,  "option_id": 76,  "display_name": "other option",  "sort_order": 1,  "is_required": true  }  ]  

the id number seen unique specific product , matches attribute number used when making post add product cart. in case product has 2 options, both required, , attribute numbers 199 , 200. find ids values have option values themselves, such id 199, option id 75. pull values option id 75 make like:

https://domain.com/api/v2/options/75/values

if used option 75 on different product have different "product option id".


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -