Hey Rob @Green Unicorn Farms!
Have you updated or added any theme/styling plugins recently to your store by any chance? It looks like there is some HTML being added to the responses from your store’s API, likely from another WordPress plugin.
The integration code is expecting the response to be in JSON format, so when it tries to parse the response, an error is thrown. You can see what this looks like using the below URL (swapping out ‘redacted’ for the consumer key and secret you use for the integration):
https://greenunicornfarms.com/wp-json/wc/v3/products?consumer_key=redacted&consumer_secret=redacted
You’ll see a bit of HTML at the top of the response that looks like this:
<link rel="stylesheet" id="wd-section-title-css" href="https://greenunicornfarms.com/wp-content/themes/woodmart/css/parts/el-section-title.min.css?ver=6.0.3" type="text/css" media="all" /> {"id":26624,"name": ...
Cheers,
Nate
Thank you very much for checking Nate!
That is super strange - It seems to come from a theme update (https://woodmart.xtemos.com/) that adds a weird stylesheet there for some reason.
I have reached out to theme support to see if they can assist ( ) and if not I’ll have to get creative.
Thank you for pointing me in the right direction!!
- Rob
**Quick update if someone runs into the same issue**
I could remove the HTML by adding a snippet to the functions.php in my child-theme.
function woodmart_enqueue_inline_style( $key ) {
if ( function_exists( 'wc' ) && wc()->is_rest_api_request() ) {
return;
}
WOODMART_Registry()->pagecssfiles->enqueue_inline_style( $key );
}
Obviously only works for the Woodmart theme and you should only try it if you are comfortable working in the code.
Thank you again Nate!
Actually I take that back… I could make the JSON format work but it’s still not recording Placed Order and Ordered Product.
Would you mind having another look at the /wp-json/wc/v3/products?consumer_key=r… for me?
Actually I take that back… I could make the JSON format work but it’s still not recording Placed Order and Ordered Product.
Would you mind having another look at the /wp-json/wc/v3/products?consumer_key=r… for me?
It looks like the syncs/webhooks were still marked as failed - I just restarted them and queued up a backfill task for you to pull in any orders recorded in the last 7 days, so you should be all caught up. Can you take another look?
Now we’re cookin’
You saved the day Nate! Thank you very much for your support on this!