dylankiss

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • in reply to: Empty cart before adding new tickets #1604568
    dylankiss
    Participant

    Hi again,

    After searching further, I found the process_front_end_tickets_form function in event-tickets-plus/src/Tribe/Commerce/WooCommerce/Main.php. Since I didn’t find any hook in there, I attached my function to the same wp_loaded action, but with an earlier priority. It seems to be working fine.

    
    add_action( 'wp_loaded', 'clear_cart_after_submitting_ticket_form', 10 );
    
    function clear_cart_after_submitting_ticket_form() {
      global $woocommerce;
      if ( empty( $_REQUEST['wootickets_process'] ) || intval( $_REQUEST['wootickets_process'] ) !== 1 || empty( $_POST['product_id'] ) ) {
    	return;
      }
      $woocommerce->cart->empty_cart();
    }
    
Viewing 1 post (of 1 total)