You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've used an event to add an bakeries and stores to the cart, so check what products to display based on chosen store, and if line items needs to be removed when swapping stores, based on the store's related bakery.
This has worked on Commerce 3 for years, and up until the latest Commerce update worked great on Commerce 4.
Now, it seems no custom fields from EVENT_MODIFY_CART_INFO is represented on the json output from the ajax / getCart controller. Even the example on https://craftcms.com/docs/commerce/4.x/extend/events.html#modifycartinfo is broken.
What happened?
Description
I've used an event to add an bakeries and stores to the cart, so check what products to display based on chosen store, and if line items needs to be removed when swapping stores, based on the store's related bakery.
This has worked on Commerce 3 for years, and up until the latest Commerce update worked great on Commerce 4.
Now, it seems no custom fields from EVENT_MODIFY_CART_INFO is represented on the json output from the ajax / getCart controller. Even the example on https://craftcms.com/docs/commerce/4.x/extend/events.html#modifycartinfo is broken.
This is my current code:
`Event::on(BaseFrontEndController::class, BaseFrontEndController::EVENT_MODIFY_CART_INFO, function(ModifyCartInfoEvent $e) {
$currentUser = Craft::$app->getUser()->getIdentity();
$cartArray = $e->cartInfo;
});`
In addition, orderStore and orderBakery is now represented directly on the order, as something that looks like an element query?
orderBakery: {select: {**: "**"}, selectOption: null, distinct: false, from: null, groupBy: null, join: [,…],…}
Steps to reproduce
Try example from https://craftcms.com/docs/commerce/4.x/extend/events.html#modifycartinfo,
get cart with js / ajax.
Expected behavior
The cart object should have a custom field "fields" with the bakery and store information set in the function.
Actual behavior
All custom fields are missing from the ajax cart object.
Craft CMS version
4.5.8
Craft Commerce version
4.3.1
PHP version
8.2.5
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
The text was updated successfully, but these errors were encountered: