Needs review
Project:
Commerce Core
Version:
4.x-dev
Component:
Order
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
18 Nov 2026 at 16:38 UTC
Updated:
18 Nov 2026 at 23:50 UTC
Jump to comment: Most recent
Customer access to carts and checkout is decided outside entity access, so code without a route (REST/JSON:API, an MCP server, custom integrations) cannot ask "can this user check out this order?" or "can this user change this cart?".
CheckoutController::checkAccess() checks the uid or cart session, a published store and, for draft orders, the cart flag. It is used by commerce_checkout.form and the payment return and cancel routes.CommerceCartHooks::orderAccess() grants update on uid or cart session, but only on front-end routes: on admin routes it returns neutral (adminContext->isAdminRoute()) and adds the route.name cache context. update therefore means "admin edit" or "change my cart" depending on the route.| Operation | Means | Granted by |
|---|---|---|
update |
Admin edit of the order or order item | Permissions only |
update_cart |
Change a draft cart and its items | commerce_cart: draft state, cart flag, uid or cart session; for order items, the order and the item are not locked |
checkout |
Go through checkout | commerce_checkout: uid or cart session, published store, non-empty order, cart flag for draft orders, access checkout permission; forbidden for canceled orders |
checkout: the conditions from CheckoutController::checkAccess() move to a hook_commerce_order_access() implementation in commerce_checkout (commerce_order can't depend on the cart session or the checkout permission). commerce_checkout.form and the payment return/cancel routes use _entity_access: 'commerce_order.checkout'.update_cart: commerce_cart grants it on orders and order items instead of update, so the admin route check (AdminContext) and the route.name cache context go away. Order item update is the admin edit too, which keeps customers off the admin order item routes.administer commerce_order pass both operations, as for any other operation.OrderRefresh::shouldRefresh() checks update_cart for anonymous customers.This also prepares organization-owned orders (see #3638816): ownership then lives in entity access only, where a B2B module can grant it.
commerce_order.update / commerce_order_item.update to update_cart, and the checkout resource to checkout.None.
Breaking, no transition release:
$order->access('update') or $order_item->access('update') for customers must check update_cart. This includes payment gateway routes requiring commerce_order.update (e.g. an approve route on the payment step), which should use checkout.administer commerce_order now pass checkout on any order (previously only the order's customer could access its checkout).CheckoutController::checkAccess() is removed, and CheckoutController no longer takes the cart session.None.
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
jsacksick commentedComment #4
jsacksick commentedPushed to
3639234-add-checkout-and(!797) and updated the issue summary. Changes from the original proposal:checkoutis granted by commerce_checkout, notOrderAccessControlHandler: the anonymous check needs the cart session (commerce_cart) and theaccess checkoutpermission.update_carttoo. Mapping order itemupdateto the order'supdate_cartreopened the admin order item edit form to customers.administer commerce_orderpasses both operations.Behavior changes are listed under API changes. The commerce_checkout tests need CI (4.x requires core ^11.5).