Banner Logo

Be a part of the family: Connect, Receive Support,
Contribute, and Reap Abundant Rewards!

How to disable a parent order

WCMp Core

Resolved
Viewing 26 reply threads
  • Author
    Posts
    • #121325
      Naoya Ishikawa
      Participant

      I am creating a ticket using the event calendar (https://theeventscalendar.com/). I’m in trouble when I buy this ticket because it creates a ticket for both the parent order and the sub-order.
      Is it possible to prevent two tickets from being created for one order, such as by disabling the parent order?

    • #121330

      Hi @Naoya Ishikawa, In order to resolve this, we need help from the plugin author.

      Please ask the plugin author, can can we stop creating of tickets from order. Share their response with us, so we can help you out.

    • #124092
      Naoya Ishikawa
      Participant

      He advised me that I could control the creation of tickets in the following ways.

      Is there anything else I need other than this information?

      add_filter( ‘get_post_metadata’, function($metadata, $post_id, $meta_key, $single){

      if( $meta_key !== ‘_tribe_has_tickets’ ) {
      return $metadata;
      }

      // This variable would determine if the order is the actual order,
      // or the “extra” order created by the other plugin.
      // “my_custom_function()” is just a placeholder here.
      // You would need to ask the other plugin developers how to check this.
      $is_order_secondary = my_custom_function( $post_id );

      if( $is_order_secondary ) {
      // Returning true here should prevent the attendee from being generated.
      return true;
      }

      // Otherwise, return original
      return $metadata;

      }, 100, 4 );

    • #124124

      @Naoya Ishikawa, thanks for the code.
      Can you also share the ticket plugin link with us, so we can check on our end.

    • #124157
      Naoya Ishikawa
      Participant

      Since the plugin that links with Woocommerce is charged, we will attach the access information to the development environment separately from the plugin link.
      You can edit this development environment.

      the actions for generating attendees and for sending the ticket emails are set up in the following file: event-tickets-plus/src/Tribe/Commerce/WooCommerce/Main.php

      Thank you

      Below is the site information and the ticket plugin link.

      【ticket plugin】
      https://wordpress.org/plugins/event-tickets/

    • #124158
      Naoya Ishikawa
      Participant
      This reply has been marked as private.
    • #124203
      This reply has been marked as private.
    • #124134
      Naoya Ishikawa
      Participant
      This reply has been marked as private.
    • #124317
      This reply has been marked as private.
    • #124331
      Naoya Ishikawa
      Participant
      This reply has been marked as private.
    • #124334
      Naoya Ishikawa
      Participant
      This reply has been marked as private.
    • #124335
      Naoya Ishikawa
      Participant
      This reply has been marked as private.
    • #124336
      Naoya Ishikawa
      Participant
      This reply has been marked as private.
    • #124370
      Naoya Ishikawa
      Participant

      I have received additional information from the plugin author and I will share it.

      ーーーーーーーーーーーーーーーーーー

      events hook into the “woocommerce_order_status_changed” action.

      If you look at the “generate_tickets()” method, it contains multiple filters that could be hooked into. Also, check out the following two variables inside this method:

      $already_generated

      $already_dispatched

      These control whether the attendee will get generated and ticket sent out. They are checking post meta attached to the order id. You may be able to hook into the “get_post_metadata” filter to control the returned values.

      You would need to probably add some logic that is able to associate the two separate order IDs that your plugin is creating.

    • #124428

      Hi,
      We have checked your Website. It will be difficult for us to study the whole plugin. We need some information from the plugin author.
      where to save the ticket as a post into the post table for order id.

      Please let us know.

      Regards,

    • #124454
      Naoya Ishikawa
      Participant

      I’m afraid I don’t understand your question.

      The tickets are created as WooCommerce products.

      The orders created by WooCommerce are of the “shop_order” post type. The _tribe_has_tickets meta key is stored in the postmeta table associated with the post id of the order.

    • #124329
      Naoya Ishikawa
      Participant
      This reply has been marked as private.
    • #124333
      Naoya Ishikawa
      Participant
      This reply has been marked as private.
    • #124562

      Hi,
      Kindly ask the plugin developer where the ticket is assigned to the respective order and save this into the post table and post meta table
      and also share the plugins name you used.

      Regards,

    • #124580
      Naoya Ishikawa
      Participant

      We received the following answers from the creator of the plugin.

      Apologies, but I’m not sure I understand your questions.

      WooCommerce orders contain a list of the products in the order. You can get the products in an order with the following:

      $order = wc_get_order( $order_id );
      $items = $order->get_items();

      The plugins we are discussing are WooCommerce, Event Tickets and Event Tickets Plus.

    • #124607
      luka.sjeffery2022
      Participant

      When I’m in my profile, I can’t change my nsfw setting. It doesn’t show up. And when I go my laptop to change it in my preferences, I can’t click the box.

    • #124614

      @Naoya Ishikawa, can you please ask the plugin author to mention the file name where we can see the codes on how orders are associated with the ticket.

    • #124675
      Naoya Ishikawa
      Participant

      The attendees, which have the post type of “tribe_wooticket”, have a meta key that stores the WooCommerce product ID: “_tribe_wooticket_product”

      You can see this being used in the following file: event-tickets-plus/src/Tribe/Commerce/WooCommerce/Main.php

    • #124765

      Hi,

      Please add this code in the function.php of the current active theme and test your site:

      add_action( 'tribe_tickets_plus_woo_before_generate_tickets', 'wcmp_order_test', 10, 1);
      function wcmp_order_test($order_id){
          if($order_id){
              $parent_order = wp_get_post_parent_id($order_id);
              if( $parent_order ){
                  return false; 
              }
          }
      }
      Copy

      Regards,

    • #124804
      Naoya Ishikawa
      Participant

      Thank you for your support.

      I tested it here, but there are still duplicate tickets issued.
      When I purchase a ticket issued by a vendor’s account with authority, it is still issued in duplicate.

    • #124834

      Hi,
      We have checked the plugin and can’t found any flexibility to stop generate ticket for suborders we need filter to stop this.
      Kindly ask to your plugin author to made some changes and add filter for order_id to prevent generate ticket for some orders.

      Regards,

    • #127667

      We haven’t heard back from you for a while. We hope this issue is fixed, so we are closing this now.
      If you need any further help, please do open another thread.

Viewing 26 reply threads

The topic ‘How to disable a parent order’ is closed to new replies.