Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Module: Complex Product API

Resource: product_custom_option

Method:
  • product_custom_option.info (SOAP V1)
  • catalogProductCustomOptionInfo (SOAP V2)

Allows you to retrieve full information about the custom option in a product.

Arguments:

TypeNameDescription
stringsessionIdSession ID
stringoptionIdOption ID
stringstoreStore view ID or code (optional)

Return:

TypeNameDescription
arrayresultArray of catalogProductCustomOptionInfoEntity

The catalogProductCustomOptionInfoEntity content is as follows:

TypeNameDescription
stringtitleCustom option title
stringtypeCustom option type. Can have one of the following values: “fixed” or “percent”
stringsort_orderCustom option sort order
intis_requireDefines whether the custom option is required
arrayadditional_fieldsArray of catalogProductCustomOptionAdditionalFields

The catalogProductCustomOptionAdditionalFields content is as follows:

TypeNameDescription
stringtitleCustom option title
stringpriceCustom option price
stringprice_typePrice type. Possible values are as follows: “fixed” or “percent”
stringskuCustom option SKU
stringmax_charactersMaximum number of characters for the customer input on the frontend (optional)
stringsort_orderCustom option sort order
stringfile_extensionList of file extensions allowed to upload by the user on the frontend (optional; for the File input type)
stringimage_size_xWidth limit for uploaded images (optional; for the File input type)
stringimage_size_yHeight limit for uploaded images (optional; for the File input type)
stringvalue_idValue ID

Faults:

Fault CodeFault Message
101Product with requested id does not exist.
104Store with requested code/id does not exist.
105Option with requested id does not exist.

Examples

Request Example SOAP V1
$client = new SoapClient('http://magentohost/api/soap/?wsdl');

// If somestuff requires API authentication,
// then get a session token
$session = $client->login('apiUser', 'apiKey');

$result = $client->call($session, 'product_custom_option.info', '1');
var_dump($result);

// If you don't need the session anymore
//$client->endSession($session);
Request Example SOAP V2
$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary

$result = $proxy->catalogProductCustomOptionInfo($sessionId, '1');
var_dump($result);
Request Example SOAP V2 (WS-I Compliance Mode)
$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');

$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));

$result = $proxy->catalogProductCustomOptionInfo((object)array('sessionId' => $sessionId->result, 'optionId' => '1'));
var_dump($result->result);
Response Example SOAP V1
array
  'title' => string 'model' (length=5)
  'type' => string 'drop_down' (length=9)
  'is_require' => string '1' (length=1)
  'sort_order' => string '0' (length=1)
  'additional_fields' =>
    array
      0 =>
        array
          'value_id' => string '1' (length=1)
          'title' => string 'monoblock' (length=9)
          'price' => string '139.9900' (length=8)
          'price_type' => string 'fixed' (length=5)
          'sku' => string 'monoblock' (length=9)
          'sort_order' => string '0' (length=1)
      1 =>
        array
          'value_id' => string '2' (length=1)
          'title' => string 'slider' (length=6)
          'price' => string '239.9900' (length=8)
          'price_type' => string 'fixed' (length=5)
          'sku' => string 'slider' (length=6)
          'sort_order' => string '0' (length=1)