Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Drupal Commerce Add Shipping Price to Product Price

By: MrJoshMiller on Feb 13th, 2013  |  syntax: PHP  |  size: 0.98 KB  |  views: 134  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. { "rules_add_shipping_price_to_product_price" : {
  2.     "LABEL" : "Add Shipping Price to Product Price",
  3.     "PLUGIN" : "reaction rule",
  4.     "REQUIRES" : [ "rules", "commerce_line_item", "commerce_product_reference" ],
  5.     "ON" : [ "commerce_product_calculate_sell_price" ],
  6.     "IF" : [
  7.       { "entity_has_field" : { "entity" : [ "commerce-line-item" ], "field" : "commerce_product" } },
  8.       { "entity_has_field" : {
  9.           "entity" : [ "commerce-line-item:commerce-product" ],
  10.           "field" : "field_shipping_price"
  11.         }
  12.       },
  13.       { "NOT data_is_empty" : { "data" : [ "commerce-line-item:commerce-product:field-shipping-price:amount" ] } }
  14.     ],
  15.     "DO" : [
  16.       { "commerce_line_item_unit_price_add" : {
  17.           "commerce_line_item" : [ "commerce_line_item" ],
  18.           "amount" : [ "commerce-line-item:commerce-product:field-shipping-price:amount" ],
  19.           "component_name" : "shipping",
  20.           "round_mode" : "1"
  21.         }
  22.       }
  23.     ]
  24.   }
  25. }