What data type to use for Commerce price field in a rule with a Views Loop (Views Rules)? I want to create duplicates of some Commerce Products with the goal of giving these products a new Product type. With great help (How to change the product type of selected Drupal Commerce products (without direct DB updates)?), I have managed to use the Views Rules module to create a Views loop that should iterate through a selection of Commerce Products and duplicating them (creating new entities) with the new product type.

All fields except one accept the data type "Text", and the variables created looks like [sku:value], [title:value] and so forth.

The problem is that I keep getting PHP errors like this:


  Unable to create entity commerce_product": Invalid data value given.
  Be sure it matches the required data type and format. Value at
  commerce_product()->commerce_price: .


... telling me that the data format for the Commerce price field is wrong though. I have tried using "text" as data type (and also "Price", "Commerce product" etc.).

Whatever I do in the action part of the Views loop, I keep getting a numeric field for the price (I can't just paste [price:value] in the field). I can switch to "Data Selection input mode", and add something like commerce-price:base-price (if I use Price as data type for the price field in the variable settings for the Rules View in question) but that also ends with a PHP error like I described above.

What to do with the variable for the commerce price here?

EDIT: this is the price field I get in the Action part of the Views loop, no matter what data type I assign to the price field in the Rules View, including Integer (in the variables configuration). I have also tried to add an action that converts the price into an integer jag before the action that creates the new entity. If I switch to Data Selection there are no price fields to be found.



And if I toggle to Data Selection mode this is what I get. No price field can be selected.



It really seems impossible to use the price field in a views loop.
Have a look at the Drupal Commerce issue about "Revise the way we handle price amount values". Especially comment nr 37 in it, which states:


  The price field is and will continue to store price amounts as integers ...


So give it a try to use "integer" for your Commerce price field. If needed, also use a Rules Action like "convert the data type" (of that price field) to convert your actual input to an integer.