Last active
February 12, 2021 07:08
-
-
Save digamber89/13e66b0afb7d5a59412569b26f1cc059 to your computer and use it in GitHub Desktop.
Zoom Integration for WooCommerce Bookings - Remove Join Via App on Order Details
This file contains hidden or 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 | |
if ( class_exists( '\Codemanas\ZoomWooBookingAddon\WooCommerce\Orders' ) ):; | |
remove_action( 'woocommerce_order_item_meta_end', [ Codemanas\ZoomWooBookingAddon\WooCommerce\Orders::get_instance(), 'email_meeting_details' ], 20 ); | |
add_action( 'woocommerce_order_item_meta_end', 'cm_email_meeting_details_without_zoom_via_app', 20, 3 ); | |
function cm_email_meeting_details_without_zoom_via_app( $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'] ) ) { | |
do_action( 'vczapi_woocommerce_before_meeting_details' ); | |
$disabled = get_option( '_vczapi_woocommerce_disable_browser_join' ); | |
$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-woo-addon' ); ?> | |
:</strong></li> | |
<li class="vczapi-woocommerce-email-mtg-details--list2"><strong><?php _e( 'Topic', 'vczapi-woo-addon' ); ?> | |
:</strong> <?php echo $meeting_details->topic; ?></li> | |
<li class="vczapi-woocommerce-email-mtg-details--list3"><strong><?php _e( 'Start Time', 'vczapi-woo-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-woo-addon' ); ?> | |
:</strong> <?php echo $meeting_details->timezone; ?></li> | |
<!-- <li class="vczapi-woocommerce-email-mtg-details--list4">--> | |
<!-- <a target="_blank" rel="nofollow" href="--><?php //echo esc_url( $meeting_details->join_url ); ?><!--">--><?php //_e( 'Join via App', 'vczapi-woo-addon' ); ?><!--</a>--> | |
<!-- </li>--> | |
<?php if ( empty( $disabled ) ) { ?> | |
<li class="vczapi-woocommerce-email-mtg-details--list5"> | |
<?php | |
$pwd = ! empty( $meeting_details->password ) ? $meeting_details->password : false; | |
echo Codemanas\ZoomWooBookingAddon\DataStore::get_browser_join_link( $meeting_details->id, $pwd ); | |
?> | |
</li> | |
<?php } ?> | |
</ul> | |
<?php | |
echo ob_get_clean(); | |
} | |
do_action( 'vczapi_woocommerce_after_meeting_details' ); | |
} | |
} | |
} | |
} | |
endif; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment