Skip to content

Commit bd3c87e

Browse files
committed
v2.9.6
1 parent 0c4cab7 commit bd3c87e

5 files changed

+58
-10
lines changed

changelog.txt

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
== Changelog ==
22

3+
= 2.9.6 - 29/04/2024 =
4+
* Dev - Shortcodes - `[order_customer_order_notes]` shortcode added.
5+
* WC tested up to: 8.8.
6+
7+
= 2.9.5 - 08/04/2024 =
8+
* Dev - Shortcodes - `[order_total_items_qty]` shortcode added.
9+
* Tested up to: 6.5.
10+
311
= 2.9.4 - 01/04/2024 =
412
* Dev - Shortcodes - `[order_view_url]` shortcode added.
513
* Dev - Shortcodes - `[order_edit_url]` shortcode added.

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.9.5
6+
Version: 2.9.6
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.7
11+
WC tested up to: 8.8
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.9.5' );
33+
defined( 'ALG_WC_CUSTOM_EMAILS_VERSION' ) || define( 'ALG_WC_CUSTOM_EMAILS_VERSION', '2.9.6' );
3434

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

includes/class-alg-wc-custom-emails-shortcodes.php

+40-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.9.5
5+
* @version 2.9.6
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.9.5
52+
* @version 2.9.6
5353
* @since 1.0.0
5454
*
5555
* @todo (dev) not order related (e.g., customer; product)
@@ -74,6 +74,7 @@ function __construct() {
7474
'order_cancel_url',
7575
'order_checkout_payment_url',
7676
'order_customer_note',
77+
'order_customer_order_notes',
7778
'order_date',
7879
'order_details',
7980
'order_downloads',
@@ -227,6 +228,27 @@ function user_prop( $atts, $content = '' ) {
227228
return $this->return_shortcode( $this->user->get( $atts['key'] ), $atts );
228229
}
229230

231+
/**
232+
* order_customer_order_notes.
233+
*
234+
* @version 2.9.6
235+
* @since 2.9.6
236+
*
237+
* @todo (dev) `comment_date`?
238+
* @todo (dev) `comment_author`, `comment_author_email`?
239+
* @todo (dev) customizable glue (`<br>`)?
240+
* @todo (dev) customizable sorting?
241+
*/
242+
function order_customer_order_notes( $atts, $content = '' ) {
243+
if ( ! $this->order ) {
244+
return '';
245+
}
246+
$notes = $this->order->get_customer_order_notes();
247+
$notes = wp_list_pluck( $notes, 'comment_content' );
248+
$notes = implode( '<br>', $notes );
249+
return $this->return_shortcode( $notes, $atts );
250+
}
251+
230252
/**
231253
* order_checkout_payment_url.
232254
*
@@ -813,9 +835,11 @@ function clear( $atts, $content = '' ) {
813835
* @version 1.0.0
814836
* @since 1.0.0
815837
*
816-
* @todo (dev) more common atts, e.g., find/replace, strip_tags, any_func, etc.
838+
* @todo (dev) more common atts, e.g., on_empty, find/replace, strip_tags, any_func, etc.
817839
*/
818840
function return_shortcode( $value, $atts ) {
841+
842+
// Add, multiply
819843
if ( is_numeric( $value ) ) {
820844
if ( ! empty( $atts['add'] ) ) {
821845
$value += $atts['add'];
@@ -824,6 +848,8 @@ function return_shortcode( $value, $atts ) {
824848
$value *= $atts['multiply'];
825849
}
826850
}
851+
852+
// Format
827853
if ( isset( $atts['format'] ) ) {
828854
switch ( $atts['format'] ) {
829855
case 'price':
@@ -833,7 +859,17 @@ function return_shortcode( $value, $atts ) {
833859
$value = sprintf( $atts['format'], $value );
834860
}
835861
}
836-
return ( '' !== $value ? ( ( isset( $atts['before'] ) ? $atts['before'] : '' ) . $value . ( isset( $atts['after'] ) ? $atts['after'] : '' ) ) : '' );
862+
863+
// Before, after
864+
return ( '' !== $value ?
865+
(
866+
( isset( $atts['before'] ) ? $atts['before'] : '' ) .
867+
$value .
868+
( isset( $atts['after'] ) ? $atts['after'] : '' )
869+
) :
870+
''
871+
);
872+
837873
}
838874

839875
}

langs/custom-emails-for-woocommerce.pot

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,12 @@ msgstr ""
111111
msgid "Renewal new order"
112112
msgstr ""
113113

114-
#: includes/class-alg-wc-custom-emails-shortcodes.php:174
114+
#: includes/class-alg-wc-custom-emails-shortcodes.php:175
115115
#, php-format
116116
msgid "Created by the \"%s\" plugin"
117117
msgstr ""
118118

119-
#: includes/class-alg-wc-custom-emails-shortcodes.php:175
119+
#: includes/class-alg-wc-custom-emails-shortcodes.php:176
120120
msgid "Custom Emails for WooCommerce"
121121
msgstr ""
122122

readme.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: wpcodefactory, algoritmika, anbinder, karzin, omardabbas, kousikmu
33
Tags: woocommerce, emails, email, custom email, custom emails
44
Requires at least: 4.4
55
Tested up to: 6.5
6-
Stable tag: 2.9.5
6+
Stable tag: 2.9.6
77
License: GNU General Public License v3.0
88
License URI: http://www.gnu.org/licenses/gpl-3.0.html
99

@@ -146,6 +146,10 @@ Dive in and discover more tools to empower your WooCommerce Store!
146146

147147
== Changelog ==
148148

149+
= 2.9.6 - 29/04/2024 =
150+
* Dev - Shortcodes - `[order_customer_order_notes]` shortcode added.
151+
* WC tested up to: 8.8.
152+
149153
= 2.9.5 - 08/04/2024 =
150154
* Dev - Shortcodes - `[order_total_items_qty]` shortcode added.
151155
* Tested up to: 6.5.

0 commit comments

Comments
 (0)