• WooSEN Hooks – Filters

    WooSEN Hooks

    Filters

    Email Filters

    Filter: ‘woocommerce_email_wsen_content_{EMAIL_ID}’

    Parameter: $content String – The existing main text content of the email.

    Parameter: $subscription Object- The subscription object associated with the email.

    Parameter: $wc_email Object- The WC Email object.

    Description: This filter allows the main text content of the email to be updated. The unique email ID should be added in place of “{EMAIL_ID}” in the filter name. Email ID’s can be found by navigating to the WooSend email rules (WordPress Admin -> WooCommerce -> Settings -> Subscription Notifications -> Email Rules), where the unique email ID is listed after the “Email ID” label.

    Example

    The following would be placed in functions.php within your theme.

    
    
    add_filter('woocommerce_email_wsen_content_{EMAIL_ID}', 'yourprefix_update_email_message_for_manual_renewal_subscriptions', 10, 3);
    function yourprefix_update_email_message_for_manual_renewal_subscriptions($content, $subscription, $wc_mail){
    
         /**
          * As an example, check if the subscription is set to renew manually,
          * and update the message if so.
          */
         if( !is_object($subscription) )
              return $content;
    
         if( true === $subscription->get_requires_manual_renewal() || 'true' === $subscription->get_requires_manual_renewal() ){
    
              $content = 'This is the new email message for subscriptions are set to manually renew.';
         
         }
    
         return $content;
    
    }
    
    
    ARS