Okay
  Public Ticket #3357722
Customizing the WooCommerce information
Closed

Comments

  • Wade started the conversation

    Hi there,

    I trust you are well.

    This plugin is great, but there is one small detail lacking at the moment, which you might be able to assist with.

    When a ticket is created, and an order placed, the customer gets the following fields in their WooCommerce order.

        Event ID:
        Event:
        Start Date:
        End Date:
        Link:

    Please advise as to how we can edit the information displayed in the order which is received by the customer.

    Specifically, I need to REMOVE the Event ID, the end date and the link. I need this removed from the WooCommerce email only.

    P.S. see attached image. It seems to be pulling from there.

    Attached files:  WhatsApp Image 2023-04-24 at 14.34.39.jpeg

  •  785
    Zhivko replied

    Hi,

    Open your theme or child-theme functions.php file and place this hook somewhere at the bottom:

    add_filter('woocommerce_order_item_get_formatted_meta_data', function ($meta, $instance) {
        if (function_exists('get_current_screen') && 'shop_order' === get_current_screen()->id) {
            return $meta;
        }
        if ('1' !== get_post_meta($instance->get_product_id(), 'stec_bookable', true)) {
            return $meta;
        }
        $skip = array('event_id', 'event_offset', 'event_end', 'event_permalink');
        $labels_array = array(
            'event_id'        => esc_html__('Event ID', 'stec'),
            'event_title'     => esc_html__('Event', 'stec'),
            'event_start'     => esc_html__('Start Date', 'stec'),
            'event_end'       => esc_html__('End Date', 'stec'),
            'event_offset'    => esc_html__('Repeat Offset', 'stec'),
            'event_permalink' => esc_html__('Link', 'stec')
        );
        $filtered_meta = array();
        foreach ($meta as $var) {
            if (in_array($var->display_key, $skip)) {
                continue;
            }
            if (isset($labels_array[$var->key])) {
                $var->display_key = $labels_array[$var->key];
            }
            $filtered_meta[]  = $var;
        }
        return $filtered_meta;
        
    }, 5, 3);



    Stachethemes Developer