I want have a product that user can change the price of it to custom ,I want programmically change the price of product when user submit a custom form with entered price.

my require is I want to have product that according to entered value by user ,product price change and then add to his/her cart. really I dont know how can I achieve it. appreciate any urgency help

2 Answers 2


I suppose the existing answer is fine if every customer gets a unique version of the product to purchase. However, it should be obvious that if more than one person uses this it would fail.

You should instead look at what we recommend in this video tutorial:


The main idea is that you can enrich the line item with custom pricing information and then use the product sell price calculation system to swap in the appropriate custom price.


I found simple method, load product and then update product:

  $product = commerce_product_load((int)$product_id);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.