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.