Last active
February 25, 2019 16:09
-
-
Save skyshab/16b281840bc89f39f75217011024720c to your computer and use it in GitHub Desktop.
Generate any stuck orders that didn't process due to the delay
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// add this action/function to your child theme's functions.php, | |
// save, and reload the site. Remove snippet afterwards. | |
add_action( 'wp', 'maybe_regenerate_tickets'); | |
function maybe_regenerate_tickets() { | |
// uncomment this to reset and run again | |
// update_option( 'tribe_regen_only_once', '' ); | |
// check if this has already run | |
if ( get_option( 'tribe_regen_tickets_only_once' ) != 'completed' ) { | |
// Add the WC order IDs for any "stuck" orders. | |
// These can be found by visiting the WC order pages. | |
// The id will be the number displayed at the top of the page, and in the URL | |
$ids = array(); // add ids inside this array, separated by commas. | |
// get the ticket object instance | |
$woo_tickets = Tribe__Tickets_Plus__Commerce__WooCommerce__Main::get_instance(); | |
// loop through each order id, and trigger ticket generation | |
foreach ( $ids as $id ) { | |
$woo_tickets->generate_tickets( $id ); | |
} | |
// prevent from running again | |
update_option( 'tribe_regen_only_once', 'completed' ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment