| @@ -17,9 +17,9 @@ | ||
| 17 | 17 | public static $recipient; |
| 18 | 18 | |
| 19 | 19 | private function __construct() {} |
| 20 | 20 | |
| 21 | - public static function email_preview_output( $order_id, $email_id, $email_address = '', $variant = '' ) { | |
| 21 | + public static function email_preview_output( $order_id, $email_id, $email_address = '' ) { | |
| 22 | 22 | $current_email = yaymail_get_email( $email_id ); |
| 23 | 23 | $current_email = ! empty( $current_email ) && method_exists( $current_email, 'get_root_email' ) ? $current_email->get_root_email() : ''; |
| 24 | 24 | |
| 25 | 25 | if ( empty( $current_email ) ) { |
| @@ -32,13 +32,11 @@ | ||
| 32 | 32 | |
| 33 | 33 | $email_class = get_class( $current_email ); |
| 34 | 34 | |
| 35 | 35 | $order = wc_get_order( $order_id ); |
| 36 | - $template_data = new YayMailTemplate( $email_id, '', $variant ); | |
| 37 | - // Enabled-ness always comes from the default design; the variant only swaps the layout. | |
| 38 | - $default_template = '' === $variant ? $template_data : new YayMailTemplate( $email_id ); | |
| 36 | + $template_data = new YayMailTemplate( $email_id ); | |
| 39 | 37 | |
| 40 | - if ( ! $default_template->is_enabled() ) { | |
| 38 | + if ( ! $template_data->is_enabled() ) { | |
| 41 | 39 | return self::render_default_preview( $current_email, $email_class, $order ); |
| 42 | 40 | } |
| 43 | 41 | |
| 44 | 42 | self::$recipient = is_email( $email_address ) ? $email_address : ''; |
| @@ -48,18 +46,8 @@ | ||
| 48 | 46 | |
| 49 | 47 | add_filter( 'woocommerce_email_recipient_' . $current_email->id, [ __CLASS__, 'no_recipient' ] ); |
| 50 | 48 | add_filter( 'woocommerce_new_order_email_allows_resend', '__return_true' ); |
| 51 | 49 | add_filter( 'yaymail_is_preview_email', '__return_true' ); |
| 52 | - if ( '' !== $variant ) { | |
| 53 | - // Preview the variant being edited; rule-based resolution is skipped while previewing. | |
| 54 | - add_filter( | |
| 55 | - 'yaymail_email_get_variant', | |
| 56 | - function () use ( $variant ) { | |
| 57 | - return $variant; | |
| 58 | - }, | |
| 59 | - 20 | |
| 60 | - ); | |
| 61 | - } | |
| 62 | 50 | |
| 63 | 51 | $core_template_ids = SupportedPlugins::get_instance()->get_template_ids_from_core(); |
| 64 | 52 | $addon_template_ids = SupportedPlugins::get_instance()->get_all_addon_supported_template_ids(); |
| 65 | 53 | $supported_template_ids = array_merge( $core_template_ids, $addon_template_ids ); |