acrDefaultTemplate = apply_filters( 'acr_default_email_template', array( 'tags' => array( '{product_list}' => __( 'A formatted table of products that were in the order at the time of abandonment', 'advanced-cart-recovery' ), '{full_name}' => __( 'Combination of the first & last name', 'advanced-cart-recovery' ), '{first_name}' => __( 'First Name', 'advanced-cart-recovery' ), '{last_name}' => __( 'Last Name', 'advanced-cart-recovery' ), '{cart_link}' => __( 'Link to the WooCommerce cart page which has their order pre-filled (pinching functionality from Email Cart here)', 'advanced-cart-recovery' ), '{site_url}' => __( 'The website\'s url', 'advanced-cart-recovery' ), '{site_name}' => __( 'The website\'s name', 'advanced-cart-recovery' ), '{unsubscribe}' => __( 'Unsubscribe Link', 'advanced-cart-recovery' ), ), 'subject' => __( 'We noticed you left before you could finish your order ...', 'advanced-cart-recovery' ), 'body' => __( '
Hi {first_name}
' . 'Looks like you left our site before you could finish your order recently.
' . '{product_list}
' . 'Would you like to complete it now?
' . 'Click this link to proceed: {cart_link}
' . 'Regards,' . '{site_name} - {site_url}
' . 'Stop receiving abandoned cart notices, click {unsubscribe}', 'advanced-cart-recovery' ) ) ); } /** * Perform email check, get the template ID for email then pass to the email sender with other required args. * * @param int $cartID * @param array $acrStatus * @param string $email * * @since 1.0.0 */ public function acrEmailSender( $cartID, $acrStatus, $email ){ $acrEmailSchedules = get_option( ACR_EMAIL_SCHEDULES_OPTION ); foreach ( $acrStatus as $key => $status ) { if( array_key_exists( $key, $acrEmailSchedules ) && get_post_status( $cartID ) !== false ) ACR_AJAX::acrSendEmail( $cartID, $key, $acrStatus, $email ); } do_action( 'acr_email_sender', $cartID, $acrStatus, $email ); } /** * Parse email contents, replace email template tags with appropriate values. * * @param string $content * @param array $tags * @param array $exclude * * @return string * @since 1.0.0 */ public function acrParseEmailContent( $content, $tags, $exclude = array() ){ foreach ( $tags as $tag => $val ) { if( ! in_array( $tag, $exclude ) ){ $content = str_replace( '{' . $tag . '}', $val , $content ); } } return apply_filters( 'acr_parse_email_content', $content, $tags ); } /** * This will fetch info about the cart and then return the appropriate values. * * @param integer $cartID * @param string $getInfo * * @return string * @since 1.0.0 */ public function acrGetCartInfo( $cartID, $getInfo ){ $orderID = (int) get_post_meta( $cartID, '_acr_order_id', true ); if ( WC()->cart instanceof WC_Cart ) { $wcCart = WC()->cart; } else { $wcCart = new WC_Cart(); } $fullName = ''; $firstName = ''; $lastName = ''; $email = ''; $userMeta = ''; // Get user info from order if( $orderID ){ $user = get_post_meta( $orderID ); $userMeta = array(); foreach ( $user as $key => $value ) { $userMeta[ ltrim( $key, '_' ) ] = $value; } $fullName = trim( $userMeta[ 'billing_first_name' ][ 0 ] . ' ' . $userMeta[ 'billing_last_name' ][ 0 ] ); $firstName = $userMeta[ 'billing_first_name' ][ 0 ]; $lastName = $userMeta[ 'billing_last_name' ][ 0 ]; $email = $userMeta[ 'billing_email' ][ 0 ]; } switch ( $getInfo ) { case 'product_list': $order = new WC_Order( $orderID ); ob_start(); ?>