> <?php echo $bloginfo; // phpcs:ignore ?> >
is_wc_gte_30() ) { if ( ! is_object( $coupon ) || ! is_callable( array( $coupon, 'get_id' ) ) ) { continue; } $coupon_id = $coupon->get_id(); if ( empty( $coupon_id ) ) { continue; } $is_free_shipping = ( $coupon->get_free_shipping() ) ? 'yes' : 'no'; $discount_type = $coupon->get_discount_type(); $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 : ''; $discount_type = ( ! empty( $coupon->discount_type ) ) ? $coupon->discount_type : ''; $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 ); if ( empty( $coupon_id ) || empty( $discount_type ) ) { continue; } $coupon_post = get_post( $coupon_id ); $coupon_meta = $woocommerce_smart_coupon->get_coupon_meta_data( $coupon ); $coupon_type = ( ! empty( $coupon_meta['coupon_type'] ) ) ? $coupon_meta['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, ); wc_get_template( 'coupon-design/' . $design . '.php', $args, '', plugin_dir_path( WC_SC_PLUGIN_FILE ) . 'templates/' ); } ?>