Skip to content

Implement auto-cancel unpaid orders feature with settings #8157

Closed
Shreyansh284 wants to merge 2 commits intonopSolutions:developfrom
Shreyansh284:issue-8120-auto-cancel–unpaid-orders

Hidden character warning

The head ref may contain hidden characters: "issue-8120-auto-cancel\u2013unpaid-orders"
Closed

Implement auto-cancel unpaid orders feature with settings #8157
Shreyansh284 wants to merge 2 commits intonopSolutions:developfrom
Shreyansh284:issue-8120-auto-cancel–unpaid-orders

Conversation

@Shreyansh284
Copy link
Copy Markdown
Contributor

Fixes #8120

📌 Summary

Implemented automatic cancellation of unpaid orders (Payment Status: Pending) after a configurable time
period using a scheduled task.

⚙️ Features Added

  • Added setting to enable/disable auto-cancellation of unpaid orders (disabled by default)
  • Configurable delay (in minutes) after which unpaid orders are cancelled (default: 600 minutes)
  • Ability to exclude specific payment methods from auto-cancellation via multi-select dropdown
  • Option to restore order items back to the shopping cart after cancellation (disabled by default)

🛠️ Technical Implementation

  • Extended OrderSettings with new configuration properties
  • Added admin UI controls under Configuration → Settings → Order
  • Implemented CancelUnpaidOrdersTask using IScheduleTask
  • Efficiently fetches only eligible orders (PaymentStatus.Pending & older than configured time)
  • Uses IOrderService for order cancellation
  • Uses IPaymentPluginManager to dynamically load payment methods for dropdown
  • Stores ignored payment methods as comma-separated system names (nopCommerce standard)

🧪 Testing

  • Verified scheduled task cancels eligible unpaid orders correctly
  • Confirmed excluded payment methods are not affected
  • Validated optional cart restoration functionality
  • Tested settings persistence and UI behavior

⚠️ Notes

  • Feature is disabled by default to avoid unintended behavior
  • No breaking changes introduced
  • Follows existing nopCommerce coding standards and patterns
Screenshot 2026-04-11 at 3 07 44 PM Screenshot 2026-04-11 at 3 09 55 PM Screenshot 2026-04-11 at 3 10 29 PM

@AndreiMaz
Copy link
Copy Markdown
Member

Thanks a lot! But we've also already implemented it. Here is the branch (will be merged soon) - https://github.com/nopSolutions/nopCommerce/tree/issue-8120-auto-cancel-unpaid-orders

@AndreiMaz AndreiMaz requested a review from exileDev April 12, 2026 05:44
@exileDev
Copy link
Copy Markdown
Contributor

exileDev commented May 6, 2026

Thank you for your contribution, but we have already fixed this, as mentioned above.

@exileDev exileDev closed this May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto cancel unpaid orders

4 participants