Created
December 20, 2022 07:08
-
-
Save techies23/12ff71355998083d93647fac5cf13fba to your computer and use it in GitHub Desktop.
Change the join links to a link that you want for Zoom integration with WooCommerce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
remove_action( 'woocommerce_order_item_meta_end', [ | |
\Codemanas\ZoomWooCommerceAddon\Orders::get_instance(), | |
'email_meeting_details' | |
], 20 ); | |
add_action( 'woocommerce_order_item_meta_end', 'reshape_zoom_order_item_meta', 20, 3 ); | |
function reshape_zoom_order_item_meta( $item_id, $item, $order ) { | |
if ( $order->get_status() === "completed" || $order->get_status() === "processing" ) { | |
$product_id = $item['product_id']; | |
$post_id = get_post_meta( $product_id, '_vczapi_zoom_post_id', true ); | |
if ( ! empty( $post_id ) ) { | |
$fields = get_post_meta( $post_id, '_meeting_fields_woocommerce', true ); | |
$meeting_details = get_post_meta( $post_id, '_meeting_zoom_details', true ); | |
if ( ! empty( $meeting_details ) && ! empty( $fields['enable_woocommerce'] ) ) { | |
$tz_for_check = new DateTimeZone( 'UTC' ); | |
$dateTimeTomorrow = new DateTime( 'NOW', $tz_for_check ); | |
if ( ( true == apply_filters( 'vczapi_woocommerce_show_past_meetings_in_account_details', ( ! empty( get_option( 'vczapi_wc_hide_completed_meetings' ) ) ) ) ) && $meeting_details->type != 8 && $meeting_details->type != 9 && $meeting_details->type != 3 ) { | |
$meeting_date_to_check = vczapi_dateConverter( $meeting_details->start_time, 'UTC', false ); | |
if ( $dateTimeTomorrow >= $meeting_date_to_check ) { | |
return; | |
} | |
} elseif ( ( true == apply_filters( 'vczapi_woocommerce_show_past_meetings_in_account_details', ( ! empty( get_option( 'vczapi_wc_hide_completed_meetings' ) ) ) ) ) && ( $meeting_details->type == 8 || $meeting_details->type == 9 ) | |
// && $meeting_details->type != 3 | |
) { | |
if ( class_exists( 'Codemanas\ZoomPro\Helpers' ) ) { | |
$last_occurrence = end( $meeting_details->occurrences ); | |
$meeting_date_to_check = vczapi_dateConverter( $last_occurrence->start_time, 'UTC', false ); | |
if ( $dateTimeTomorrow >= $meeting_date_to_check ) { | |
return; | |
} | |
} | |
} | |
do_action( 'vczapi_woocommerce_before_meeting_details' ); | |
$content = apply_filters( 'vczapi_woocommerce_order_item_meta', '', $item_id, $item, $order ); | |
if ( ! empty( $content ) ) { | |
echo $content; | |
} else { | |
ob_start(); | |
?> | |
<ul class="vczapi-woocommerce-email-mtg-details"> | |
<li class="vczapi-woocommerce-email-mtg-details--list1"> | |
<strong><?php _e( 'Meeting Details', 'vczapi-woocommerce-addon' ); ?> | |
:</strong></li> | |
<li class="vczapi-woocommerce-email-mtg-details--list2"> | |
<strong><?php _e( 'Topic', 'vczapi-woocommerce-addon' ); ?> | |
:</strong> <?php echo $meeting_details->topic; ?></li> | |
<li class="vczapi-woocommerce-email-mtg-details--list3"> | |
<strong><?php _e( 'Start Time', 'vczapi-woocommerce-addon' ); ?> | |
:</strong> | |
<?php | |
echo vczapi_dateConverter( $meeting_details->start_time, $meeting_details->timezone, 'F j, Y @ g:i a' ); | |
?></li> | |
<li class="vczapi-woocommerce-email-mtg-details--list3"> | |
<strong><?php _e( 'Timezone', 'vczapi-woocommerce-addon' ); ?> | |
:</strong> | |
<?php | |
echo $meeting_details->timezone; | |
?></li> | |
<li class="vczapi-woocommerce-event-url-details--list4"> | |
<a href="<?php echo get_permalink($post_id); ?>">See event here</a> | |
</li> | |
</ul> | |
<?php | |
$content .= ob_get_clean(); | |
echo $content; | |
} | |
do_action( 'vczapi_woocommerce_after_meeting_details', $meeting_details, $post_id ); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment