$email_heading ) );
} else {
woocommerce_get_template( 'emails/email-header.php', array( 'email_heading' => $email_heading ) );
}
}
?>
' . esc_html( $coupon_code ) . '' );
?>
is_wc_gte_30() ) {
if ( ! is_object( $coupon ) || ! is_callable( array( $coupon, 'get_id' ) ) ) {
return;
}
$coupon_id = $coupon->get_id();
if ( empty( $coupon_id ) ) {
return;
}
$is_free_shipping = ( $coupon->get_free_shipping() ) ? 'yes' : 'no';
$expiry_date = $coupon->get_date_expires();
$coupon_code = $coupon->get_code();
} else {
$coupon_id = ( ! empty( $coupon->id ) ) ? $coupon->id : 0;
$is_free_shipping = ( ! empty( $coupon->free_shipping ) ) ? $coupon->free_shipping : '';
$expiry_date = ( ! empty( $coupon->expiry_date ) ) ? $coupon->expiry_date : '';
$coupon_code = ( ! empty( $coupon->code ) ) ? $coupon->code : '';
}
$coupon_amount = $woocommerce_smart_coupon->get_amount( $coupon, true, $order );
$coupon_post = get_post( $coupon_id );
$coupon_data = $woocommerce_smart_coupon->get_coupon_meta_data( $coupon );
$coupon_type = ( ! empty( $coupon_data['coupon_type'] ) ) ? $coupon_data['coupon_type'] : '';
if ( 'yes' === $is_free_shipping ) {
if ( ! empty( $coupon_type ) ) {
$coupon_type .= __( ' & ', 'woocommerce-smart-coupons' );
}
$coupon_type .= __( 'Free Shipping', 'woocommerce-smart-coupons' );
}
if ( ! empty( $expiry_date ) ) {
if ( $woocommerce_smart_coupon->is_wc_gte_30() && $expiry_date instanceof WC_DateTime ) {
$expiry_date = ( is_callable( array( $expiry_date, 'getTimestamp' ) ) ) ? $expiry_date->getTimestamp() : null;
} elseif ( ! is_int( $expiry_date ) ) {
$expiry_date = strtotime( $expiry_date );
}
if ( ! empty( $expiry_date ) && is_int( $expiry_date ) ) {
$expiry_time = (int) $woocommerce_smart_coupon->get_post_meta( $coupon_id, 'wc_sc_expiry_time', true );
if ( ! empty( $expiry_time ) ) {
$expiry_date += $expiry_time; // Adding expiry time to expiry date.
}
}
}
$coupon_description = '';
if ( ! empty( $coupon_post->post_excerpt ) && 'yes' === $show_coupon_description ) {
$coupon_description = $coupon_post->post_excerpt;
}
$is_percent = $woocommerce_smart_coupon->is_percent_coupon( array( 'coupon_object' => $coupon ) );
$args = array(
'coupon_object' => $coupon,
'coupon_amount' => $coupon_amount,
'amount_symbol' => ( true === $is_percent ) ? '%' : get_woocommerce_currency_symbol(),
'discount_type' => wp_strip_all_tags( $coupon_type ),
'coupon_description' => ( ! empty( $coupon_description ) ) ? $coupon_description : wp_strip_all_tags( $woocommerce_smart_coupon->generate_coupon_description( array( 'coupon_object' => $coupon ) ) ),
'coupon_code' => $coupon_code,
'coupon_expiry' => ( ! empty( $expiry_date ) ) ? $woocommerce_smart_coupon->get_expiration_format( $expiry_date ) : __( 'Never expires', 'woocommerce-smart-coupons' ),
'thumbnail_src' => $woocommerce_smart_coupon->get_coupon_design_thumbnail_src(
array(
'design' => $design,
'coupon_object' => $coupon,
)
),
'classes' => '',
'template_id' => $design,
'is_percent' => $is_percent,
);
$coupon_target = '';
$wc_url_coupons_active_urls = get_option( 'wc_url_coupons_active_urls' ); // From plugin WooCommerce URL coupons.
if ( ! empty( $wc_url_coupons_active_urls ) ) {
$coupon_target = ( ! empty( $wc_url_coupons_active_urls[ $coupon_id ]['url'] ) ) ? $wc_url_coupons_active_urls[ $coupon_id ]['url'] : '';
}
if ( ! empty( $coupon_target ) ) {
$coupon_target = home_url( '/' . $coupon_target );
} else {
$coupon_target = home_url( '/?sc-page=shop&coupon-code=' . $coupon_code );
}
$coupon_target = apply_filters( 'sc_coupon_url_in_email', $coupon_target, $coupon );
?>
$woocommerce_smart_coupon ) );
if ( true === $is_print ) {
$print_coupon_url = add_query_arg(
array(
'print-coupons' => 'yes',
'source' => 'wc-smart-coupons',
'coupon-codes' => $coupon_code,
),
home_url()
);
?>
|