So I'm using some code from this post to make my orders show in Wordpress/Woocommerce using a shortcode.
function shortcode_my_orders( $atts ) {
extract( shortcode_atts( array(
'order_count' => -1
), $atts ) );
ob_start();
wc_get_template( 'myaccount/my-orders.php', array(
'current_user' => get_user_by( 'id', get_current_user_id() ),
'order_count' => $order_count
) );
return ob_get_clean();
}
add_shortcode('my_orders', 'shortcode_my_orders');
The code does function, it is displaying info correctly when I use the shortcode. But I am getting a JSON Error.
When I put the code into JSON Parser online, it returns this
error: "SyntaxError: JSON.parse: unexpected keyword at line 1 column 1 of the JSON data"
Is this an error with the particular code I'm using or something else?
Any help gratefully received.