Flat Shipping price per product using Drupal Commerce
If you are using commerce shipping 1.x, you should do something like this:

Disclaimer, this is written by memory.

This is based on two fields on the product,

field_shipping_type containing the shipping type
field_flat_rate containing the actual rate for the product.


Create a custom module and add a folder for the shipping plugin, fx plugins/quotes/custom_shipping
Create the custom_shipping.inc with the plugin definition.

&lt;?php

$plugin = array(
  'title' =&gt; t('Custom shipping'),
  'description' =&gt; t('Descriptive text.'),
  'handler' =&gt; array(
    'class' =&gt; 'CustomShipping',
    'parent' =&gt; 'quote_base'
  ),
  'price_component' =&gt; array(
   'title' =&gt; t('Shipping'),
   'display_title' =&gt; t('Shipping'),
   'weight' =&gt; -40,
  ),
);

Create the actual shipping logic in the CustomShipping.class.php file in the same dir. All you need is something like this:

class CustomShipping extends CommerceShippingQuote {
  public function calculate_quote($currency_code, $form_values = array(), $order = NULL, $pane_form = NULL, $pane_values = NULL) {
    $order = $order ? $order : $this-&gt;order;
    $order_wrapper = entity_metadata_wrapper('commerce_order', $order);
    $price = 0;
    // Loop through the products, and add costs.
    foreach ($order_wrapper-&gt;commerce_line_items as $line_item_wrapper) {
      switch ($line_item_wrapper-&gt;commerce_product-&gt;field_shipping_type-&gt;value()) {
        case 'free':
          break;
        case 'flat_rate':
          $price += $line_item_wrapper-&gt;commerce_product-&gt;field_flat_rate-&gt;amount-&gt;value();
          break;
        case 'call_for_details':
          // Call for details
          break;
      }
    }
    return array(array(
      'amount' =&gt; $price,
      'currency_code' =&gt; $currency_code,
      'label' =&gt; t('Custom shipping method line item label'),
      'quantity' =&gt; 1,
    ));
  }
}