php - how to create product with custom option on bigcommerce api? -
php - how to create product with custom option on bigcommerce api? -
how add together custom alternative color , size when im creating product. there doc: https://github.com/bigcommerce/bigcommerce-api-php
this code:
public function addproduct($data) { $fields = array( "name" => $data['name'], "description" => $data['description'] ); homecoming bigcommerce_api::createproduct($fields); } i need add together info product options: $data['color'], $data['size']
how that?
you need create alternative set, add together options set , assign alternative set product.
essentially this:
public function addproduct($data) { //create alternative set $optionset = bigcommerce_api::createoptionsets(['name' => 'tshirts']); //create alternative $option = bigcommerce_api::createoptions(['name' => 'color', 'display_name' => 'color', 'type' => 's']); //.. create alternative values //assign alternative option set bigcommerce_api::createoptionsets_options(['option_id' => $option->id], $optionset->id); $fields = array( "name" => $data['name'], "description" => $data['description'], "option_set_id" => $optionset->id, ); homecoming bigcommerce_api::createproduct($fields); } resources: https://developer.bigcommerce.com/api/products
php api rest bigcommerce
Comments
Post a Comment