header

Magento 1.x Software Support Notice

For Magento Commerce 1, Magento is providing software support through June 2020. Depending on your Magento Commerce 1 version, software support may include both quality fixes and security patches. Please review our Magento Software Lifecycle Policy to see how your version of Magento Commerce 1 is supported.

For Magento Open Source 1.5 to 1.9, Magento is providing software security patches through June 2020 to ensure those sites remain secure and compliant. Visit our information page for more details about our software maintenance policy and other considerations for your business.

Product Custom Option Info

Edit this page on GitHub

Module: Complex Product API

Resource: product_custom_option

Method:

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

Arguments:

Type Name Description
string sessionId Session ID
string optionId Option ID
string store Store view ID or code (optional)

Return:

Type Name Description
array result Array of catalogProductCustomOptionInfoEntity

The catalogProductCustomOptionInfoEntity content is as follows:

Type Name Description
string title
Custom option title
string
type
Custom option type. Can have one of the following values: "fixed" or "percent"
string
sort_order
Custom option sort order
int is_require
Defines whether the custom option is required
array additional_fields
Array of catalogProductCustomOptionAdditionalFields

The catalogProductCustomOptionAdditionalFields content is as follows:

Type Name Description
string title
Custom option title
string
price
Custom option price
string
price_type
Price type. Possible values are as follows: "fixed" or "percent"
string
sku
Custom option SKU
string
max_characters
Maximum number of characters for the customer input on the frontend (optional)
string
sort_order
Custom option sort order
string
file_extension
List of file extensions allowed to upload by the user on the frontend (optional; for the File input type)
string
image_size_x
Width limit for uploaded images (optional; for the File input type)
string
image_size_y
Height limit for uploaded images (optional; for the File input type)
string
value_id
Value ID

Faults:

Fault Code Fault Message
101 Product with requested id does not exist.
104 Store with requested code/id does not exist.
105 Option 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)