Skip to content

Instantly share code, notes, and snippets.

@digamber89
Last active December 29, 2020 08:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save digamber89/1786fd091ce0d6a81e41ed8b4d9c6bd2 to your computer and use it in GitHub Desktop.
Save digamber89/1786fd091ce0d6a81e41ed8b4d9c6bd2 to your computer and use it in GitHub Desktop.
Add Join Links to Reminder Emails - Zoom Integration for WooCommerce Bookings
<?php
$join_link = \Codemanas\ZoomWooBookingAddon\DataStore::get_join_link($booking);
if($join_link){
?>
<tr>
<th style="text-align:left; border: 1px solid #eee;" scope="row"><?php _e('Join meeting','woocommerce-bookings'); ?></th>
<td style="text-align:left; border: 1px solid #eee;"><?php echo $join_link; ?></td>
</tr>
<?php
}
?>
<?php
/**
* Customer booking reminder email.
*
* This template can be overridden by copying it to yourtheme/woocommerce-bookings/emails/customer-booking-reminder.php
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes.
*
* @see https://docs.woocommerce.com/document/bookings-templates/
* @author Automattic
* @version 1.10.0
* @since 1.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
do_action( 'woocommerce_email_header', $email_heading );
?>
<?php if ( $booking->get_order() ) : ?>
<p>
<?php
/* translators: 1: billing first name */
echo esc_html( sprintf( __( 'Hello %s', 'woocommerce-bookings' ), ( is_callable( array( $booking->get_order(), 'get_billing_first_name' ) ) ? $booking->get_order()->get_billing_first_name() : $booking->get_order()->billing_first_name ) ) );
?>
</p>
<?php endif; ?>
<p>
<?php
/* translators: 1: booking start date */
echo esc_html( sprintf( __( 'This is a reminder that your booking will take place on %1$s.', 'woocommerce-bookings' ), $booking->get_start_date() ) );
?>
</p>
<table cellspacing="0" cellpadding="6" style="width: 100%; border: 1px solid #eee;" border="1" bordercolor="#eee">
<tbody>
<tr>
<th scope="row" style="text-align:left; border: 1px solid #eee;"><?php esc_html_e( 'Booked Product', 'woocommerce-bookings' ); ?></th>
<td style="text-align:left; border: 1px solid #eee;"><?php echo esc_html( $booking->get_product()->get_title() ); ?></td>
</tr>
<tr>
<th style="text-align:left; border: 1px solid #eee;" scope="row"><?php esc_html_e( 'Booking ID', 'woocommerce-bookings' ); ?></th>
<td style="text-align:left; border: 1px solid #eee;"><?php echo esc_html( $booking->get_id() ); ?></td>
</tr>
<?php
$resource = $booking->get_resource();
$resource_label = $booking->get_product()->get_resource_label();
if ( $booking->has_resources() && $resource ) :
?>
<tr>
<th style="text-align:left; border: 1px solid #eee;" scope="row"><?php echo ( '' !== $resource_label ) ? esc_html( $resource_label ) : esc_html__( 'Booking Type', 'woocommerce-bookings' ); ?></th>
<td style="text-align:left; border: 1px solid #eee;"><?php echo esc_html( $resource->post_title ); ?></td>
</tr>
<?php endif; ?>
<tr>
<th style="text-align:left; border: 1px solid #eee;" scope="row"><?php esc_html_e( 'Booking Start Date', 'woocommerce-bookings' ); ?></th>
<td style="text-align:left; border: 1px solid #eee;"><?php echo esc_html( $booking->get_start_date( null, null, wc_should_convert_timezone( $booking ) ) ); ?></td>
</tr>
<tr>
<th style="text-align:left; border: 1px solid #eee;" scope="row"><?php esc_html_e( 'Booking End Date', 'woocommerce-bookings' ); ?></th>
<td style="text-align:left; border: 1px solid #eee;"><?php echo esc_html( $booking->get_end_date( null, null, wc_should_convert_timezone( $booking ) ) ); ?></td>
</tr>
<?php if ( wc_should_convert_timezone( $booking ) ) : ?>
<tr>
<th style="text-align:left; border: 1px solid #eee;" scope="row"><?php esc_html_e( 'Time Zone', 'woocommerce-bookings' ); ?></th>
<td style="text-align:left; border: 1px solid #eee;"><?php echo esc_html( str_replace( '_', ' ', $booking->get_local_timezone() ) ); ?></td>
</tr>
<?php endif; ?>
<?php if ( $booking->has_persons() ) : ?>
<?php
foreach ( $booking->get_persons() as $id => $qty ) :
if ( 0 === $qty ) {
continue;
}
$person_type = ( 0 < $id ) ? get_the_title( $id ) : __( 'Person(s)', 'woocommerce-bookings' );
?>
<tr>
<th style="text-align:left; border: 1px solid #eee;" scope="row"><?php echo esc_html( $person_type ); ?></th>
<td style="text-align:left; border: 1px solid #eee;"><?php echo esc_html( $qty ); ?></td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
<?php
$join_link = \Codemanas\ZoomWooBookingAddon\DataStore::get_join_link($booking);
if($join_link){
?>
<tr>
<th style="text-align:left; border: 1px solid #eee;" scope="row"><?php _e('Join meeting','woocommerce-bookings'); ?></th>
<td style="text-align:left; border: 1px solid #eee;"><?php echo $join_link; ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php do_action( 'woocommerce_email_footer' ); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment