Tags/topics: 
1
Answers
Vote up!
0
Vote down!

Is it possible to have the user set a price for a product with Commerce?

I want to make something sort of similar to Humble Bundle, where a user can set the price for what they are buying. Please don't ask me why, I have my reasons.

Asked by: ozwizm
on August 6, 2013

1 Answer

Vote up!
1
Vote down!

I took the opportunity to answer this with a video. Hope this helps!

Here's an export of the rule: http://pastebin.com/MyF6vqCa

And the module I mentioned that would make it possible to do this for only select kinds of products is here: https://drupal.org/project/commerce_custom_product

STEP BY STEP

1) Create a price field on the line item type: admin/commerce/config/line-items/product/fields

2) Create a pricing rule: admin/commerce/config/product-pricing/rules/add

3) Add a condition "Entity has field" and select the line item as the entity and the field from the field you created in step 1.

4) Add an action "Set a variable" and choose "decimal" as the variable type, select the source to come from "commerce-line-item:field-YOUR-FIELD:amount-decimal"

5) Add an action "Calculate a value" and choose "added variable" (or whatever you called the variable from step 4 and choose to "multiply" by "100"

6) Add an action "Set the unit price to a specific amount" and choose the "result" variable from step 5

Josh

Josh Miller
Answer by: Josh Miller
Posted: Aug 7, 2013

Comments

Thank you so much, I'm sure this would have helped a lot, but I recently decided to go the old fashioned way and make my website from scratch with html, css, php and all of that good stuff. It's gonna be a lot more work ahead of me, but it's good to learn, and coding things from scratch has always been more natural to me. Thanks again though

- ozwizm on August 9, 2013

Is there a way to do this in Drupal 8, commerce 2?

- petergus on November 7, 2018