If I understood correctly, 2500 words would be $12.50
If you add a custom field to the Product line item type, say "Word Count" (field_word_count). You could use the rule attached at the end to give you ideas on how to accomplish what you want.
Initially, I struggled to get the correct pricing. In the "Calculate a Value" action, I was using .005 as the multiplication factor, but the correct value is .005 x 100 = .5
I expected the data type conversion to be handled on the backend, but doesn't seem to be the case. (The price 1 dollar is really stored as integer 100 to prevent floating point issues, so .005 dollars is actually .5 integer, which makes things more confusing :D, any hints appreciated!)
{ "rules_word_count" : {
"LABEL" : "Word Count",
"PLUGIN" : "reaction rule",
"WEIGHT" : "10",
"REQUIRES" : [ "rules", "commerce_line_item", "commerce_product_reference" ],
"ON" : [ "commerce_product_calculate_sell_price" ],
"IF" : [
{ "entity_has_field" : { "entity" : [ "commerce-line-item" ], "field" : "field_word_count" } }
],
"DO" : [
{ "data_calc" : {
"USING" : {
"input_1" : [ "commerce-line-item:field-word-count" ],
"op" : "*",
"input_2" : ".5"
},
"PROVIDE" : { "result" : { "word_count_price" : "Calculation result" } }
}
},
{ "commerce_line_item_unit_price_amount" : {
"commerce_line_item" : [ "commerce_line_item" ],
"amount" : [ "word-count-price" ],
"component_name" : "base_price",
"round_mode" : "0"
}
}
]
}
}