Hello,
I’ve just updated to RC12.3 and I get an error message (call to undefined function add_shortcode()) with this function I added to the functions.php file in order to list woocommerce orders :
function woo_order_history( $atts ) {
extract( shortcode_atts( array(
'order_count' => -1
), $atts ) );
ob_start();
$customer_orders = wc_get_orders( apply_filters( 'woocommerce_my_account_my_orders_query', array(
'customer' => get_current_user_id(),
'page' => $current_page,
'paginate' => true,
) ) );
wc_get_template(
'myaccount/orders.php',
array(
'current_page' => absint( $current_page ),
'customer_orders' => $customer_orders,
'has_orders' => 0 < $customer_orders->total,
)
);
return ob_get_clean();
}
add_shortcode('woocommerce_history', 'woo_order_history');
I never got any error message with the previous theme versions.
Here’s the exact error message from the log :
PHP Fatal error: Uncaught Error: Call to undefined function add_shortcode() in .../wp-includes/functions.php:8471
Hello,
@Lalit The RC version is for testing the recurring stripe payment because a problem has been reported.
@sco Did you add that code in functions.php file? Usually, you can find your orders in Woocommerce -> Orders https://i.imgur.com/2tFVIQS.png, without any code. Please check if you remove the code if the error is still displayed.
Thank you!
Hi,
Please re-read my message as you’ll find the answer to your question.
1. I need this code to add orders history elsewhere
2. I had no problem before updating to version RC12.3, the code was working fine
3. Yes, the code is pasted at the end of the functions file.
There is something linked to the update (RC12.3) that prevents this code to work properly and that generates the error message about the add_shortcode function.
This is what my question was about.
Regards.
Hello @sco,
Please provide the wp-admin access and cpanel access to investigate this error.
Send those details to contact@tagdiv.com
Thank you!
