Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hooks before and after the subscription info table email #753

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion templates/emails/plain/subscription-info.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* @author Brent Shepherd / Chuck Mac
* @package WooCommerce_Subscriptions/Templates/Emails
* @version 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.4
* @version 1.1.0 - Migrated from WooCommerce Subscriptions v3.0.4
*/

if ( ! defined( 'ABSPATH' ) ) {
Expand All @@ -17,6 +17,8 @@
$has_automatic_renewal = false;
$is_parent_order = wcs_order_contains_subscription( $order, 'parent' );

do_action( 'wcs_email_before_subscription_info', $subscriptions, $order, $has_automatic_renewal, $is_parent_order, $sent_to_admin, $plain_text );

echo "\n\n" . __( 'Subscription information', 'woocommerce-subscriptions' ) . "\n\n";
foreach ( $subscriptions as $subscription ) {
$has_automatic_renewal = $has_automatic_renewal || ! $subscription->is_manual();
Expand Down Expand Up @@ -61,3 +63,5 @@
)
);
}

do_action( 'wcs_email_after_subscription_info', $subscriptions, $order, $has_automatic_renewal, $is_parent_order, $sent_to_admin, $plain_text );
7 changes: 6 additions & 1 deletion templates/emails/subscription-info.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* @author Brent Shepherd / Chuck Mac
* @package WooCommerce_Subscriptions/Templates/Emails
* @version 1.0.0 - Migrated from WooCommerce Subscriptions v3.0.4
* @version 1.1.0 - Migrated from WooCommerce Subscriptions v3.0.4
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
Expand All @@ -16,6 +16,9 @@

$has_automatic_renewal = false;
$is_parent_order = wcs_order_contains_subscription( $order, 'parent' );

do_action( 'wcs_email_before_subscription_info', $subscriptions, $order, $has_automatic_renewal, $is_parent_order, $sent_to_admin, $plain_text );

?>
<div style="margin-bottom: 40px;">
<h2><?php esc_html_e( 'Subscription information', 'woocommerce-subscriptions' ); ?></h2>
Expand Down Expand Up @@ -74,4 +77,6 @@
}
?>
</div>
<?php

do_action( 'wcs_email_after_subscription_info', $subscriptions, $order, $has_automatic_renewal, $is_parent_order, $sent_to_admin, $plain_text );