Shows summed amount and price unexpectedly

Created on 8 October 2024, 6 months ago

Problem/Motivation

When adding an item to cart, you'd expect the add to cart confirmation layer to show the details about the product you just added to cart (and not about existing cart contents).

For example when adding 1x Orange per USD 1.99 you'd expect the confirmation to exactly show the same information.
But if you've already got 3x Orange per USD 1.99 in the cart, the Add to cart notification will show 4x Orange USD 7,96 instead of 1x Orange per USD 1.99!

Steps to reproduce

See above.

Proposed resolution

Show the amount and sum of the product just added to cart, irrespective of existing cart contents.

I guess this is a problem with current architecture, but I guess it means the architecture in Drupal Commerce needs to be aligned to better allow that. The current, unexpected UX shows it needs to be solved. I'd even see this as major UX bug. Clients are confused by this.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇩🇪Germany Anybody Porta Westfalica

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

Comments & Activities

  • Issue created by @Anybody
  • 🇮🇳India kulpratap2002

    Working on it.

  • 🇮🇳India kulpratap2002

    @anybody i try to change the summed amount on the basis of the newly added product in the cart , i think the issue is not in the commerce_add_to_cart module the issue is in the cart module which is a sub module of the commerce module, since the commerce module is tha parent module of the commerce_add_to_cart module it is taking data like 'total_price' from the OrderTotal and other files of the commerce module, so the issue is not in this module.

  • Assigned to TomTech
  • Status changed to Closed: works as designed about 1 month ago
  • 🇺🇸United States TomTech

    Hi and thanks for the report!

    A few things to note here:

    1. This has been the default behavior for ~12+ years, going back to D7. It is really a sample, though. You aren't locked into the view or the template.

    2. This can get really complicated to try and handle OOTB, depending on the merchant requirements. Some examples:

    If there is a max quantity of 10 for an item, there are currently 8 items in the cart, and the customer attempts to add 4 more, your site might only allow an increase of 2, not the 4 that was attempted.

    If you are displaying price, and the price changes when quantity is increased, which price should be displayed? The base price from the product? Or the calculated price on the order item?

    A simple way to avoid many of these issues, is to simply display the product that was added, and not display the price or quantity in the message. (Allow the cart to handle displaying the complexities of price/quantity/extended price/adjustments, etc...)

    3. Fortunately, the dialog renders a view in a template. Customizations can be achieved by modifying the view. Advanced changes can be achieved by overriding the template in your theme.

  • 🇩🇪Germany Anybody Porta Westfalica

    Thanks for your feedback and suggestions @tomtech! :)

Production build 0.71.5 2024