0

I have added a product in commerce. Each products have a price and sale price. In product listing page the price is cutout and sale price is displayed. When a product is added to the cart, sale price is not calculated in checkout. Instead original price is calculated. Since i'm new in drupal, I have no idea to solve this problem.

  • 1
    Is this related to Drupal 7 or 8? – adrum99 Oct 16 '18 at 10:41
  • @adrum99 I'm using drupal7 – Sandra Oct 16 '18 at 14:09
  • So you may try the first suggestion in my post below. – adrum99 Oct 17 '18 at 2:31
0

Could you change the field labels and make the field used for the price calculation the actual sale price field? The other one you could possibly call something like "original price" or so.

If this isn't feasible and you're on Drupal 8, it sounds like you want to implement a custom price resolver.

0

You need to change one of your views:

Shopping cart summary (Cart line item summary displayed during checkout.) I think just that you need.

Or Shopping cart block(Display a list of line items added to cart.)

If above mentioned is not the answer to your question. You need to calculate new price for product item on checkout form page.

For that you need to implement hook_form_FORM_ID_alter(&$form, &$form_state, $form_id) function in your custom module, then grabbing price from $form_state array you need to change it for your needs then assign new price to a $form_state array.

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.