hook_entity_presave showing error in commerce kickstart I have created a field calculated price in commerce add product, the code used to save calculated price on saving product.
function custom_module_entity_presave($product, $type) {
  if ($type == 'commerce_product') {

$cal=commerce_product_calculate_sell_price($product);
$currency_code=$cal['currency_code'];
$amount=$cal['amount'];
$total_amount = commerce_currency_format($amount, $currency_code);

$product->field_calculated_price['und'][0]['value']=$total_amount;
//commerce_product_save($product);

}
}
But this code showing error on saving product
Try the code without using the following line.

$total_amount = commerce_currency_format($amount, $currency_code);


The remaining code will be the following,

function custom_module_entity_presave($product, $type) {
  if ($type == 'commerce_product') {
    $cal=commerce_product_calculate_sell_price($product);
    $currency_code=$cal['currency_code'];
    $amount=$cal['amount'];
    $product-&gt;field_calculated_price['und'][0]['value']=$amount;
  }
}


If this code not showing error, then the problem will be on your field_calculated_price field type. I think it is a custom field and the problem is the field type is not compatible with commerce_currency_format.

Please make try... Hope this will help you.