Drupal 8 version or alternative

Created on 17 January 2018, over 7 years ago
Updated 17 April 2025, 4 days ago

i am wondering if anybody here knows how to accomplish what this module does in commerce 2? this functionality seems so important yet there is no way that i am aware of to achieve this in commerce 2x. any tips would be greatly appreciated. cheers

💬 Support request
Status

Active

Version

1.0

Component

Miscellaneous

Created by

🇨🇿Czech Republic pyxio

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • there is a file named PriceCalculatedFormatter.php but it doesn't appear in the list within views.

    This is because that formatter implements this method:

    public static function isApplicable(FieldDefinitionInterface $field_definition) {
      $entity_type = \Drupal::entityTypeManager()->getDefinition($field_definition->getTargetEntityTypeId());
      return $entity_type->entityClassImplements(PurchasableEntityInterface::class);
    }
    

    That method indicates that the formatter will not be offered as an option if the price field is not on a purchasable entity (i.e. Product Variation); the total price and unit price fields that you see in the cart view are fields on the Order Item.

    The rationale is explained in a comment on #3190313-6: Calculated price field formatter on products does not consider coupons that the user has applied :

    The calculated price formatter was never designed to show discounts coming from coupons. In fact, it was never designed to be used in a real order / cart context. The cart knows all of its discounts and coupons, it doesn't need the calculated price formatter to repeat the calculations. The point of the formatter is to show a product in the catalog with a valid offer applied (e.g. price list for that day/customer, discount for that product category, etc).

    I think the implication is that Commerce Core is designed to calculate all adjustments, across all line items, in one shot and then display all of them in a single flat list as components of the order total.

Production build 0.71.5 2024