Got questions? Leave your message here or Schedule a quick call with our manager now

How to work with the products?

Product API methods allow you to manage products in the store. It is possible to:

  • Create - add products
  • Read - retrieve list, info, find
  • Update - update
  • Delete - delete

Run product.add method, in order to add new products to the store, and provide all necessary parameters.

public function apiAdd($params)
{
  $params = array(
    'name'        => 'Bag',
    'model'       => 'bag_01',
    'description' => 'This is new product',
    'price'       => 99.9,
    'quantity'    => 12,
    'manufacturer'=> 'Test',
  );

  return $api->request('product.add', $params);
}

Note: You may add image, tax, manufacturer, option, variant or other info to the product by calling these methods: product.image.add, product.variant.add, product.manufacturer.add, product.tax.add, product.option.add, product.option.value.add, product.option.assign, product.option.value.assign

For more methods jump into documentation.

If you want to update the product, call product.list method  to retrieve product id.

public function apiList($params)
{
  $params = array(
    'start'  => 0,
    'count'  => 50,
    'params' => 'id,name,price',
  );

  return $api->request('product.list', $params);
}

When you get product id, you are able to update price and inventory(quantity) for this product, simply calling product.update method.

public function apiUpdate($params)
{
  $params = array(
    'id' => 69,
    'price' => 89,
  );

  return $api->request('product.update', $params);
}

Note: You may update variant, image and product option value by calling the following methods: product.variant.update, product.image.update, product.option.value.update

For more API methods visit our documentation.

Posted in: Getting Started