AI Verified

Name

Add Tickets Pro plain meta data on WooCommerce Order for Zapier

About

Alters the Modern Tribe Tickets Pro meta data to a simpler format on the WooCommerse Order so that it's easier to integrate with other systems on Zapier.

Language

PHP

Rating

Voted: 0 by 0 user(s)

Codevault

NKDAgility

Scroll down to see more snippets from this codevault.

Wordpress Compatability

The author has indicated that this snippet is compatable up to wordpress version: 6.1

Our AI bot has checked this snippet is compatable up to wordpress version: 6.1

Code Snippet Plugin Sync

Free & Pro

Download this snippet by clicking the download button, then head over to the Code Snippet Plugin settings in your wordpress admin dashboard, select the import menu then upload this file to import into your wordpress site.

Pro Only (Coming Soon)

You will be able to click a button and sync this snippet to your wordpress site automatically and from your dashboard manage all code snippets across all your wordpress sites that have the Code Snippets Pro plugin installed.

History

Last modified:

07/10/2023

Important Note

This snippet has the following status:

AI Verified

This snippet has been tested by our AI bot, see any comments below.

AI Bot Comments:

Found 0 vulnerabilities

Add Tickets Pro plain meta data on WooCommerce Order for Zapier

 
                    
1add_action( 'woocommerce_order_status_changed', 'etp_modify_saved_order_meta', 10, 2 );
2 
3function etp_modify_saved_order_meta( $order_id, $from_status = null ) {
4 if ( ! class_exists( 'Tribe__Tickets_Plus__Meta' ) ) {
5 return;
6 }
7 
8 $order = wc_get_order( $order_id );
9 $saved_meta = $order->get_meta( Tribe__Tickets_Plus__Meta::META_KEY, true );
10 
11 $restructured_data = [];
12 foreach ( $saved_meta as $product_id => $attendees ) {
13 foreach ( $attendees as $attendee ) {
14 $attendee['product_id'] = $product_id;
15 $attendee['SKU'] = "?";
16 $restructured_data[] = $attendee;
17 }
18 }
19 
20 $order->delete_meta_data( '_etp_ticket_data' );
21 $order->add_meta_data( '_etp_ticket_data', $restructured_data );
22 $order->save();
23}

0

Related Snippets

Please see some snippets below related to this snippet..

General

AI Verified

1

Remove CTP name from URL slug

Added: 1 year ago

Last Updated: 1 year ago

Code removes the Custom Post Type (CPT) name from the URL slug.

General

AI Verified

1

Remove WP media images from being created for no reason

Added: 8 months ago

Last Updated: 2 months ago

General

AI Verified

0

Disable author archives

Added: 1 year ago

Last Updated: 1 year ago

Removes the author archive section and redirects all links to author archives to the homepage. Perfect for blogs where there is only a single author.

Other Snippets in this Codevault

These are some popular snippets from this users codevault..

General

AI Verified

0

Add Tickets Pro plain meta data on WooCommerce Order for Zapier

Added: 11 months ago

Last Updated: 11 months ago

Alters the Modern Tribe Tickets Pro meta data to a simpler format on the WooCommerse Order so that it's easier to integrate with other systems on Zapier.

General

AI Verified

General

AI Verified

0

Reorder Toolset field Timezone contents

Added: 11 months ago

Last Updated: 11 months ago

<p>Takes a specific field added in Toolset and reorders the data. This was built to enable easier usage of a "Timezone" selector and could also be augmented to populate the correct data from PHP.</p>