This module prevents users from submitting the Drupal Commerce checkout form multiple times. It uses server-side locking and client-side double-click protection to ensure only one submission is processed, while automatically cleaning up locks on completion or termination.
Commerce Checkout Lock
Prevents duplicate checkout submissions in Drupal Commerce.
Features
- Server-side locking using Drupal's persistent lock backend
- Client-side double-click protection with visual feedback
- Automatic lock cleanup via kernel terminate safety net
- Configurable checkout pane for flexible placement
Installation
- Install as usual: `composer require drupal/commerce_checkout_lock`
- Enable the module
- Configure your checkout flow to include the "Checkout Lock" pane before payment
Configuration
In your checkout flow settings, add the "Checkout Lock" pane to an existing step
(e.g., "Review" or "Payment") before any payment-related panes. The pane is
invisible to customers - it only attaches the protection logic to the form.
How it works
- When checkout form submits, JavaScript disables buttons and shows "Processing..."
- The checkout pane acquires a persistent lock for the order
- If lock fails (concurrent submission), user sees an error message
- Lock releases on checkout completion or request termination (safety net)
Requirements
- Drupal 10.3+ or 11.x
- Commerce 2.x or 3.x