Hi,
Sorry for not getting back to you sooner.
You can create your own shortcodes and then use them in the custom email’s “Email content” option. For example, this PHP snippet will create the [my_alg_wc_custom_emails_order_items_data]
shortcode:
add_shortcode( 'my_alg_wc_custom_emails_order_items_data', function ( $atts, $content = '' ) {
$result = '';
if ( function_exists( 'alg_wc_custom_emails' ) && ! empty( alg_wc_custom_emails()->core->shortcodes->order ) ) {
$order = alg_wc_custom_emails()->core->shortcodes->order;
foreach ( $order->get_items() as $item ) {
foreach ( $item->get_data() as $key => $value ) {
if ( in_array( $key, array( 'radio-group-1662572212029', 'text-1662572721887', 'date-1662573909693' ) ) ) {
$result .= $key . ' - ' . $value . '<br>';
}
}
}
}
return $result;
} );
Please note that in your snippet, you are displaying cart item data, while in my snippet, we are displaying order item data – when sending an email, we don’t have cart data already. I’m not completely sure if the woocommerce_get_item_data
filter returns the same result as the $item->get_data()
function, but please give it a try.