Commerce update event not triggered

Created on 13 September 2021, over 3 years ago
Updated 4 February 2025, about 1 month ago

Problem/Motivation

Commerce cart event CART_ORDER_ITEM_UPDATE isn't triggered when you update a commerce line item (to add quantity, for example).
CART_ENTITY_ADD and CART_ORDER_ITEM_REMOVE are well triggered when you add a new item or delete one.

Steps to reproduce

Create a custom event subscriber for those events, and do "add/update/delete" items request from POSTMAN:

public static function getSubscribedEvents() {
        return [
            CartEvents::CART_ENTITY_ADD => [['addToCart', 100]],
            CartEvents::CART_ORDER_ITEM_REMOVE => [['removeFromCart', 100]],
            CartEvents::CART_ORDER_ITEM_UPDATE => [['updateCart', 100]],
        ];
    }

Proposed resolution

I'm not sure, but while "add" and "delete" use cart manager, "update" not.
Perhaps, changing "update" to use "updateOrderItem" from cart manager could solve the problem.

🐛 Bug report
Status

Fixed

Version

1.5

Component

Code

Created by

🇪🇸Spain briantes

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.

Production build 0.71.5 2024