I want to implement the solution on this link Alter cart unit price and total amount. I want to use dpm on devel to look for available fields on line items but I doesnt show on.

Code that I used: function mymodule_commerce_cart_order_refresh($order_wrapper) { dpm($order_wrapper); }

function mymodule_calculate_product_price_cart($order) { dpm($order); }

Both of these doesnt show the devel on the page.

  1. Make sure that Commerce cart context is loading in the particular page you wanted to dpm/dsm for function hook_commerce_cart_order_refresh($order_wrapper) &

  2. And where you declared this function mymodule_calculate_product_price_cart($order) { dpm($order); } can you brief this for more clarity.

| improve this answer | |
  • Basically I want to alter the total price amount after adding the product to cart or maybe when they visit the checkout page since I have a redirect to checkout after adding product to cart. – Oltus West Oct 18 '17 at 0:34
  • Hi, For altering the price based on users/ or on different condition. One way using Rules module and try to write a class based on commerce_price/resolver. Here is the reference it will definitely help you, pls follow this: modify product price. – Harish Bompally Oct 24 '17 at 5:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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