Hi, this is howI created mine, hope this helps. Within woo-custom-emails/admin/class-wcemails-instance.php
Within the function convert_template I added:
$this->find[] = '{order_items}';
$this->replace[] = $this->get_the_order_items();
Then under function get_the_order_items I added:
function get_the_order_items() {
ob_start();
if ( $items = $this->object->get_items() ) {
foreach ( $items as $item ) {
echo "<br>".$item['name']." x ".$item['qty']." ";
}
}
return ob_get_clean();
}
So now I can add {order_items} to the email template which will list the order items & quantity like this:
Wet Paper Towel x 10
Soggey Weatbix x 6
I found this place useful to find the get function ie get_the_order_items().
-
This reply was modified 8 years, 1 month ago by nicko619.
-
This reply was modified 8 years, 1 month ago by nicko619.