0

I need to add product via services, but I have strange issue with a price field.

The case is that all fields saved correctly except price field amount and it returns:

The requested URL returned error: 500 Internal Server Error : An error occurred (0): Unable to get the data property amount as the parent data structure is not set.

The url which is used: endpoint/product.

Here is the code:

fields `$node_data = array(
  'sku' => 'sku1',
  'title' => 'product title',
  'type' => 'product',
//  'commerce_price_amount' => array('amount' => 122.000, 'currency_code' => 'KWD'),
  'commerce_price_amount' => 12.000,
  'commerce_price_currency_code' => 'KWD'
); 12.000,
  'commerce_price_currency_code' => 'KWD'` 

which successfully added all fields except price.

I think it relate to price field format.

1
  • Try using a GET call with Firefox Poster (or Chrome's Postman) to retrieve a product through Commerce Services. That will reveal to you the structure of the product, which should help you build the structure to POST. Feb 12, 2015 at 15:58

1 Answer 1

0

It works with me after disable some modules related to commerce like payment, order, cart, tax and then clear cache products saved.

I still didn't know the reason for that error

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.