Skip to content

Commit 721a460

Browse files
committed
v2.9.0
1 parent 9fe05a9 commit 721a460

8 files changed

+185
-141
lines changed

Diff for: custom-emails-for-woocommerce.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
Plugin Name: Additional Custom Emails for WooCommerce
44
Plugin URI: https://wpfactory.com/item/custom-emails-for-woocommerce/
55
Description: Add custom emails to WooCommerce.
6-
Version: 2.8.1
6+
Version: 2.9.0
77
Author: WPFactory
88
Author URI: https://wpfactory.com
99
Text Domain: custom-emails-for-woocommerce
1010
Domain Path: /langs
11-
WC tested up to: 8.5
11+
WC tested up to: 8.6
1212
*/
1313

1414
defined( 'ABSPATH' ) || exit;
@@ -30,7 +30,7 @@
3030
}
3131
}
3232

33-
defined( 'ALG_WC_CUSTOM_EMAILS_VERSION' ) || define( 'ALG_WC_CUSTOM_EMAILS_VERSION', '2.8.1' );
33+
defined( 'ALG_WC_CUSTOM_EMAILS_VERSION' ) || define( 'ALG_WC_CUSTOM_EMAILS_VERSION', '2.9.0' );
3434

3535
defined( 'ALG_WC_CUSTOM_EMAILS_FILE' ) || define( 'ALG_WC_CUSTOM_EMAILS_FILE', __FILE__ );
3636

Diff for: includes/class-alg-wc-custom-emails-core.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Alg_WC_Custom_Emails_Core {
4444
* @version 2.6.0
4545
* @since 1.0.0
4646
*
47-
* @todo (feature) option to conditionally disable some standard WC emails (e.g. "order completed" email, etc.)?
47+
* @todo (feature) option to conditionally disable some standard WC emails (e.g., "order completed" email, etc.)?
4848
*/
4949
function __construct() {
5050

Diff for: includes/class-alg-wc-custom-emails-shortcodes.php

+20-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* Custom Emails for WooCommerce - Emails Shortcodes Class
44
*
5-
* @version 2.8.1
5+
* @version 2.9.0
66
* @since 1.0.0
77
*
88
* @author Algoritmika Ltd
@@ -49,7 +49,7 @@ class Alg_WC_Custom_Emails_Shortcodes {
4949
/**
5050
* Constructor.
5151
*
52-
* @version 2.8.1
52+
* @version 2.9.0
5353
* @since 1.0.0
5454
*
5555
* @todo (dev) not order related (e.g., customer; product)
@@ -76,6 +76,7 @@ function __construct() {
7676
'order_shipping_method',
7777
'order_payment_method_id',
7878
'order_payment_method_title',
79+
'order_checkout_payment_url',
7980
'order_total_items_count',
8081
'order_date',
8182
'order_details',
@@ -137,7 +138,7 @@ function translate( $atts, $content = '' ) {
137138
* @since 1.1.0
138139
*
139140
* @todo (dev) generate coupon from *order*
140-
* @todo (dev) more `$atts`, e.g. `discount_type`
141+
* @todo (dev) more `$atts`, e.g., `discount_type`
141142
* @todo (dev) optional `customer_email`
142143
* @todo (dev) optional `first_name` in coupon code
143144
*/
@@ -219,6 +220,21 @@ function user_prop( $atts, $content = '' ) {
219220
return $this->return_shortcode( $this->user->get( $atts['key'] ), $atts );
220221
}
221222

223+
/**
224+
* order_checkout_payment_url.
225+
*
226+
* @version 2.9.0
227+
* @since 2.9.0
228+
*
229+
* @todo (dev) add `[order_checkout_payment_link]` shortcode (i.e., `<a href="...">Pay</a>`)?
230+
*/
231+
function order_checkout_payment_url( $atts, $content = '' ) {
232+
if ( ! $this->order ) {
233+
return '';
234+
}
235+
return $this->return_shortcode( $this->order->get_checkout_payment_url(), $atts );
236+
}
237+
222238
/**
223239
* order_billing_email.
224240
*
@@ -695,7 +711,7 @@ function clear( $atts, $content = '' ) {
695711
* @version 1.0.0
696712
* @since 1.0.0
697713
*
698-
* @todo (dev) more common atts, e.g. find/replace, strip_tags, any_func, etc.
714+
* @todo (dev) more common atts, e.g., find/replace, strip_tags, any_func, etc.
699715
*/
700716
function return_shortcode( $value, $atts ) {
701717
if ( is_numeric( $value ) ) {

Diff for: includes/classes/class-alg-wc-custom-email.php

+9-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* Custom Emails for WooCommerce - Custom Email Class
44
*
5-
* @version 2.8.0
5+
* @version 2.9.0
66
* @since 1.0.0
77
*
88
* @author Algoritmika Ltd
@@ -283,6 +283,8 @@ function alg_wc_ce_hook_triggers() {
283283
*
284284
* @version 2.0.0
285285
* @since 1.0.0
286+
*
287+
* @todo (dev) `is_callable( array( $object_id, 'get_id' )`?
286288
*/
287289
function alg_wc_ce_trigger( $object_id ) {
288290
$this->alg_wc_ce_send_email( $object_id, false );
@@ -311,7 +313,7 @@ function schedule_single( $timestamp, $hook, $args ) {
311313
/**
312314
* alg_wc_ce_send_email.
313315
*
314-
* @version 2.8.0
316+
* @version 2.9.0
315317
* @since 1.3.0
316318
*
317319
* @todo (dev) `wc_get_product( $object_id )`: better solution, e.g., use `current_filter()`?
@@ -331,6 +333,11 @@ function alg_wc_ce_send_email( $object_id, $do_force_send, $note = '' ) {
331333
// Debug
332334
$this->alg_wc_ce_debug( sprintf( __( 'Triggered [%s].', 'custom-emails-for-woocommerce' ), current_filter() ) );
333335

336+
// Object ID
337+
if ( is_callable( array( $object_id, 'get_id' ) ) ) {
338+
$object_id = $object_id->get_id();
339+
}
340+
334341
// Check if it's enabled
335342
if ( ! $this->is_enabled() || ! apply_filters( 'alg_wc_custom_emails_is_enabled', true, $this, $object_id, $do_force_send ) ) {
336343
$this->alg_wc_ce_debug( __( 'Disabled.', 'custom-emails-for-woocommerce' ) );

Diff for: includes/settings/class-alg-wc-custom-email-settings.php

+20-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* Custom Emails for WooCommerce - Email Settings Class
44
*
5-
* @version 2.8.0
5+
* @version 2.9.0
66
* @since 1.0.0
77
*
88
* @author Algoritmika Ltd
@@ -74,7 +74,7 @@ function get_default_subject() {
7474
* @version 1.0.0
7575
* @since 1.0.0
7676
*
77-
* @todo (dev) better default content (include more shortcodes, e.g. `[clear]`, `[if]` etc.)
77+
* @todo (dev) better default content (include more shortcodes, e.g., `[clear]`, `[if]` etc.)
7878
*/
7979
function get_default_content() {
8080
return '[order_details]' . PHP_EOL .
@@ -392,17 +392,31 @@ function get_stop_emails() {
392392
) );
393393
}
394394

395+
/**
396+
* get_order_statuses.
397+
*
398+
* @version 2.9.0
399+
* @since 2.9.0
400+
*/
401+
function get_order_statuses() {
402+
$statuses = wc_get_order_statuses();
403+
if ( function_exists( 'wcs_get_subscription_statuses' ) ) {
404+
$statuses = array_merge( $statuses, wcs_get_subscription_statuses() );
405+
}
406+
return $statuses;
407+
}
408+
395409
/**
396410
* get_form_fields.
397411
*
398-
* @version 2.8.0
412+
* @version 2.9.0
399413
* @since 1.0.0
400414
*
401415
* @todo (dev) move this function to a separate file/class
402416
* @todo (feature) "Custom triggers"
403417
* @todo (feature) `cc` and `bcc`
404418
* @todo (desc) `delay`: better desc
405-
* @todo (dev) add sections, e.g. "Conditions"
419+
* @todo (dev) add sections, e.g., "Conditions"
406420
* @todo (dev) replace `woocommerce` text domain with `custom-emails-for-woocommerce` everywhere
407421
* @todo (feature) separate option for plain content
408422
*/
@@ -735,7 +749,7 @@ function get_form_fields( $email ) {
735749
'type' => 'multiselect',
736750
'class' => 'wc-enhanced-select',
737751
'default' => array(),
738-
'options' => wc_get_order_statuses(),
752+
'options' => $this->get_order_statuses(),
739753
'css' => 'width:100%;',
740754
),
741755
'excluded_order_statuses' => array(
@@ -744,7 +758,7 @@ function get_form_fields( $email ) {
744758
'type' => 'multiselect',
745759
'class' => 'wc-enhanced-select',
746760
'default' => array(),
747-
'options' => wc_get_order_statuses(),
761+
'options' => $this->get_order_statuses(),
748762
'css' => 'width:100%;',
749763
),
750764
'order_conditions_logical_operator' => array(

Diff for: includes/settings/class-alg-wc-custom-emails-settings-general.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function __construct() {
3434
*
3535
* @todo (desc) `alg_wc_custom_emails_enabled_trigger_groups`
3636
* @todo (dev) `alg_wc_custom_emails_titles`: move to the email settings?
37-
* @todo (dev) `alg_wc_custom_emails_titles`: icon for settings (e.g. `<span class="dashicons dashicons-admin-settings"></span>`)?
37+
* @todo (dev) `alg_wc_custom_emails_titles`: icon for settings (e.g., `<span class="dashicons dashicons-admin-settings"></span>`)?
3838
* @todo (desc) `alg_wc_custom_emails_total`: better desc?
3939
*/
4040
function get_settings() {

0 commit comments

Comments
 (0)