Format {email_order_items_table}
-
My client wants the receipt to have more space between the items in the order table that shows up on the email notification, he wants to cut up the receipt to make labels for each item ordered.
The page I need help with: [log in to see the link]
-
Yes,
That is possible by editing the file /woocommerce/templates/emails/plain/email-order-items.php
And adding the following code on line 39:
echo '----------------';
That way there be a line separation between the items in the receipt.
If you want to add space instead line separation you can add the following code on line 39 of the above file:
echo '\n'
This seems to work if i put this in twice do i get a bigger space?
If you want this dashed line and additional space add
echo '\n'; echo '----------------'; echo '\n';
\n stands for new line
But make a copy of this file as if you update woocommerce it will be rewritten.
Then you should copy it again.
- This reply was modified 3 years, 9 months ago by Georgi Bakalski.
- This reply was modified 3 years, 9 months ago by Georgi Bakalski.
Blank spaces are showing up as shown below.
Lamb Shawarma Platter X 1 = $15.95 \n-----------\n - Salads: Greek - Sauces: Garlic, Hot, Tahina - Dips: Hummus - Pita Bread: Yes Beef Donair Wrap X 1 = $12.99 \n-----------\n - Size: Medium - Toppings: Feta Cheese, Lettuce, Tomato, Pickles, Parsley, Banana Peppers, Pickled Cabbage - Sauces: Garlic, Sweet Beef Donair Wrap X 1 = $10.99 \n-----------\n - Size: Small - Toppings: Feta Cheese, Lettuce, Tomato, Onions - Sauces: Garlic, Sweet Meat Salads X 1 = $13.99 \n-----------\n - Meat: Chicken Shawarma - Toppings: Lettuce, Tomato, Pickles, Parsley - Sauces: Garlic, Sweet - Extras: Tzatziki
Would like it to show like:
Lamb Shawarma Platter X 1 = $15.95 - Salads: Greek - Sauces: Garlic, Hot, Tahina - Dips: Hummus - Pita Bread: Yes ----------- Beef Donair Wrap X 1 = $12.99 - Size: Medium - Toppings: Feta Cheese, Lettuce, Tomato, Pickles, Parsley, Banana Peppers, Pickled Cabbage - Sauces: Garlic, Sweet ----------- Beef Donair Wrap X 1 = $10.99 - Size: Small - Toppings: Feta Cheese, Lettuce, Tomato, Onions - Sauces: Garlic, Sweet ----------- Meat Salads X 1 = $13.99 - Meat: Chicken Shawarma - Toppings: Lettuce, Tomato, Pickles, Parsley - Sauces: Garlic, Sweet - Extras: Tzatziki
try
echo “\r\n”;
echo ‘—————-‘;
echo “\r\n”;will this also fix the way the list is broken up? if you notice the product gets seperated from its options
No, the above will add lines both between product and options.
you can also try adding
‘after’ => ‘\n’,
on line 48 of email-order-items.php
This specifies what will show up after the product options
these two lines cause a checkout error
echo “\r\n”; echo “\r\n”;
this is not resolved FYI
ADD
‘after’ => “\n ———— \n”,
the above will add a line after the product options
I am also trying to use additional line spaces between Orders using WOO INSTANT NOTIFICATIONS.
Using your code addition:
echo “\r\n”;
echo ‘—————-‘;
echo “\r\n”;Caused a fault on checkout submission for me too.
But using the following did not:
echo ‘—————-‘;
The printout in plain text displays as shown below… (unfortunately with the divide line ______ in an odd place).
Telephone Order
**************************
Number: #2251,
**************************
FOOD ITEMS:
Jerk Jackfruit & Grilled Pineapple X 1 = £6.50
———–
– Choose your topping:: Jacket Potato
Ploughmans. Cheese, Ham Pickle, Lettuce, Apple, Boiled Egg, Gherkin X
1 = £7.00
———–
– Choose your topping:: WrapsThe “add on” food items ie: ‘- Choose your topping:: Jacket Potato’ (created by Advanced Product Fields for WooCommerce Plug-in) display with the second item….
Desirable output:
Telephone Order ************************** Number: #2251, ************************** FOOD ITEMS: Jerk Jackfruit & Grilled Pineapple X 1 = £6.50 - Choose your topping:: Jacket Potato ----------- Ploughmans. Cheese, Ham Pickle, Lettuce, Apple, Boiled Egg, Gherkin X 1 = £7.00 - Choose your topping: Wraps -----------
FYI:
The generic Woocommerce email displays properly like this:Jerk Jackfruit & Grilled Pineapple × 1
Choose your topping: Jacket Potato£ 6.50
________________________________________________________________________
Ploughmans. Cheese, Ham Pickle, Lettuce, Apple, Boiled Egg, Gherkin × 1Choose your boat: Wraps £7.00
________________________________________________________________________So woo commerce email format knows where the divide __________ between orders should be. But not Woo Instant Notifications. Not really that customizable as yet
- This reply was modified 3 years, 7 months ago by uk2021.
Problem resolved at my end with some tweaking of the above code!
Editing this file:
/wp-content/plugins/woocommerce/templates/emails/plain/email-order-items.php
I used the code below and inserted it into line 63 (at the bottom of the plain text template) and left the rest of the file untouched (as installed).
echo “\r\n”;
echo “——————————”;
echo “\r\n”;And here is the result on printout:
**************************
Number: #2329,
**************************
FOOD ITEMS:
BBQ Lamb & Mint Burger X 1 = £4.50
Peas Choice: mushy
——————————
BBQ Lamb & Mint Burger X 1 = £4.50
Peas Choice: garden
——————————
BBQ Lamb & Mint Burger X 1 = £4.50
Peas Choice: none
——————————
Euca Hill Chardonnay 750ml X 1 = £10.00
——————————`Hope that helps someone else needing a bit more clarity between order lines!
Thanks for the feedback and your contribution to the community
- The topic ‘Format {email_order_items_table}’ is closed to new replies.