1

I am using a number of related WooCommerce plugins including WooCommerce Subscriptions and Events Tickets. The Events Tickets plugin has an add on plugin that adds event and attendee information to the WooCommerce order pages, including emails. On the WooCommerce Subscription specific emails, the CSS outputs directly to the mail, it's as if the echo function has been stripped. However, to contrast, on the non-subscription mails the CSS isn't output it simply doesn't add the styles. Here's how the stylesheet is being called in a function in the plugin:

echo '<style type="text/css">'; include( 'resources/tribe-attendee-meta-table.css' ); echo '</style>';

The CSS looks like this:

.woocommerce table a.event-title { font-size: 1.25em; font-style: italic; }

This seems to be added dynamically as an inline style. I have to say I am not how this is being applied, but led be to believe it was something to do with the style names:

.woocommerce table

So if I write the CSS this way:

a.event-title { font-size: 1.25em; font-style: italic; }

Then in the non-subscription notification email everything is added correctly as inline styles.

Unfortunately for the default subscription the CSS is being output to the page like this:

https://screencast.com/t/J7B8utYqs

To solve the issue I've simply disabled the styles being applied, since it doesn't make a major difference to how the mail looks, as long as the information is included.

I hope that provides enough information to help me look in the right area.

Evakos
  • 152
  • 2
  • 11

1 Answers1

0

Personally, I don't like using it like this anyway but have you tried setting the CSS to a variable and then including it in the echo? It's not that the echo is being ignored, it's that the include is not echoing at all, it's doing exactly what it says on the tin, including the file.

Try:

$css = file_get_contents('resources/tribe-attendee-meta-table.css');
echo "<style>" . $css . "</style>";

p.s. I know there are a million ways to write this so syntax not important right now :)

TeeJayEss
  • 151
  • 1
  • 12
  • I did think about that but thought since it is applying the style correctly depending in the mail notification then it wouldn't be that. I did try your approach, but still has the same result. There is something specific about the the class names or how they're being applied dynamically. You see it's echoing the CSS but somehow applying it as a inline class. Something is breaking in that process. – Evakos Jun 21 '19 at 12:40