Skip to content

Instantly share code, notes, and snippets.

@justinshreve
Created November 2, 2015 16:04
Show Gist options
  • Save justinshreve/7cf5c59883fee40efa93 to your computer and use it in GitHub Desktop.
Save justinshreve/7cf5c59883fee40efa93 to your computer and use it in GitHub Desktop.
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