Open itecedor opened 8 years ago
Further digging revealed that the bad data is in the response from wp-admin/admin-ajax.php?security=adfbc650e3&action=wc_pos_payload, and here's the bad section:
{ "templates": { "print": { "receipt": "<html><head><meta charset=\"utf-8\"><script type="text/javascript">window.NREUM||(NREUM={}),
I have no idea how that got in there or how to fix it =(
Same problem with ours
looks like the <script type="text/javascript" needs to be passed like <script type=\"text/javascript\"
The script being injected is a new relic browser javascript. I think this is a hosting issue. I am using wpengine and am contacting them.
@otherjohn I'm on wpengine too, couldn't figure out where this json was being created
Ok, this is an issue where the New Relic script is being auto injected at the server level. It's not a code problem. To turn it off, you need to request that the host turn it off for your install.
Hi guys, thanks for reporting this issue.
From what you describe, the server is injecting javascript into the receipt template. WooCommerce POS is a javascript web app, so any script tag in a template is going to kill the app.
The demo is hosted on WPEngine as well but doesn't seem to have this problem (yet). I had a look through the WPEngine site and couldn't see anything about NewRelic. Do you know if it only applies to certain plans?
Also, I'm wondering if you guys have custom receipt templates? Perhaps it only applies for files in the wp-content/themes folder?
Yes I do have a custom receipt template, that's probably the difference! Thanks @kilbot
The next version of WooCommerce POS stores the custom templates in the DB, rather than a file, this may fix the issue.
@itecedor Can you let me know if removing the custom template fixed the problem? I'm still surprised that WPEngine/NewRelic would insert code into every file ... that seems like over-reach to me.
Same issue over here on the "production" environment here where New-Relic is used. Anyone allready has an solution for this? I didn't use any customized template, just an fresh Wordpress / Woocommerce installation with Woopos on top of it.
EDIT After updating all new-relic scripts on the server (apt-get upgrade) and an reboot everything seems to work fine again.
wpengine turned off this feature after I reported it. I think they did it server wide. You can manually turn it off with editing a flag in the php.ini.
New Relic looks for files that contain certain html tags and injects the content on just those files. If the template is stored in the DB then it will not be affected by this. John
I think an external library updated overnight or something, because it was working yesterday (and I haven't changed anything on my site since yesterday). Now when we try to use the POS, this is what we see:
Browser console shows: