Let customers cancel their order from your Order Status page on Shopify. Customers can request a cancellation if the order hasn't shipped and automatically void their payment.
Automated Order Cancellations
Customers can request to cancel their order if it's before the preset cutoff time. If the customer has access to cancel their order, it'll trigger a Shopify workflow to cancel the order which will: refund the customer's payment, cancel the order's fulfillment, send the customer a branded order cancellation from your storefront, and refund shipping.
This Shopify Flow template works with checkout extensibility.