<?php
/*
This snippet will create a WooCommerce product for every future event not created after installing the WC add-on.
Delete when synced once, as future events are synced automatically already and this will affect performance of your site.
For installation instructions please see:
http://wp-events-plugin.com/tutorials/how-to-safely-add-php-code-to-wordpress/
*/
function em_create_products_sync(){
$args = array('scope' => 'future');
foreach( EM_Events::get( $args ) as $EM_Event ){
\Events_Manager_WooCommerce\Product::em_event_save( true, $EM_Event );
}
}
add_action('em_woocommerce_loaded', 'em_create_products_sync');
Comments