Set visibility back to hidden when event has expired (or at sale end date)

Home Forums Ticket Products Event Tickets Plus Set visibility back to hidden when event has expired (or at sale end date)

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1406326
    momofone
    Participant

    Hello,

    I am using the ‘wootickets_after_save_ticket’ hook to trigger the ticket product to be set to ‘visible’ in the WooCommerce catalogue.

    Is there another hook I can use that triggers when a ticket expires or has a sales end_date set to set that back to “hidden” in the WooCommerce catalogue?

    I am using the following to set the initial visibility:

    add_action( 'wootickets_after_save_ticket', 'tribe_events_woo_change_visibility' );
    function tribe_events_woo_change_visibility( $ticket_ID ) {
    	if ($product = wc_get_product($ticket_ID)) {
    		$product->set_catalog_visibility('visible');
    		$product->save();
    	}	
    }

    Thanks for any help.

    • This topic was modified 8 years, 4 months ago by momofone.
    #1408286
    Cliff
    Member

    Hi, Jacqui. Thanks for your thorough question.

    No, there’s not, but you could add it via cron.

    Within your existing snippet, you could add logic to create a cron: https://developer.wordpress.org/plugins/cron/scheduling-wp-cron-events/

    Please let me know how this goes for you.

    #1421473
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Set visibility back to hidden when event has expired (or at sale end date)’ is closed to new replies.