Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Allows WooCommerce booking orders to be canceled by the cancel unpaid orders cron job.
<?php
/*
* Plugin Name: Cancel Unpaid Bookings
* Author: WooThemes
* Description: Allows booking orders to be canceled by the cancel unpaid orders cron job.
*/
// woocommerce-cancel-unpaid-bookings.php
function woocommerce_cancel_unpaid_booking_orders_from_admin( $return, $order ) {
if ( 'wc-pending' === $order->post_status && '1' === get_post_meta( $order->id, '_booking_order', true ) ) {
return true;
}
return $return;
}
add_filter( 'woocommerce_cancel_unpaid_order', 'woocommerce_cancel_unpaid_booking_orders_from_admin', 20, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment