I think I have the exact same problem, but mine is with a custom woocommerce endpoint that I created.
I have created an endpoint like this;
This is written in setup.php
file
function krenovate_add_group_classes_endpoint()
{
add_rewrite_endpoint('group-classes', EP_ROOT | EP_PAGES);
}
add_action('init', __NAMESPACE__.'\\krenovate_add_group_classes_endpoint');
function krenovate_group_classes_query_vars($vars)
{
$vars[] = 'group-classes';
return $vars;
}
add_filter('query_vars', __NAMESPACE__.'\\krenovate_group_classes_query_vars', 0);
function krenovate_add_group_classes_link_my_account($items)
{
$items['group-classes'] = 'Group Classes';
return $items;
}
add_filter('woocommerce_account_menu_items', __NAMESPACE__.'\\krenovate_add_group_classes_link_my_account');
function krenovate_group_classes_content()
{
include \App\template_path(locate_template('woocommerce/myaccount/group-classes.blade.php'));
}
add_action('woocommerce_account_group-classes_endpoint', __NAMESPACE__.'\\krenovate_group_classes_content');
Now my endpoint renders all the PHP stuff fine but it is missing all the blade properties.
Every time I put a foreach
loop
@php
$Classes = \App\GroupClass::getGroupClasses();
@endphp
@if($Classes)
@foreach($Classes as $class)
@endforeach
@endif
Call to a member function addLoop() on null (View: /var/www/html/wp-content/themes/cfi-theme/resources/views/woocommerce/myaccount/my-account.blade.php) (View: /var/www/html/wp-content/themes/cfi-theme/resources/views/woocommerce/myaccount/my-account.blade.php) (View: /var/www/html/wp-content/themes/cfi-theme/resources/views/woocommerce/myaccount/my-account.blade.php)
Now this doesn’t happen in my-account page. I have overridden it with my blade template file.
The one fix mentioned to add this
@php
$__env = App\sage(‘blade’);
@endphp
by @mejta throws this error
Class sage.‘blade’ does not exist (View: /var/www/html/wp-content/themes/cfi-theme/resources/views/woocommerce/myaccount/my-account.blade.php) (View: /var/www/html/wp-content/themes/cfi-theme/resources/views/woocommerce/myaccount/my-account.blade.php) (View: /var/www/html/wp-content/themes/cfi-theme/resources/views/woocommerce/myaccount/my-account.blade.php)
This error is thrown on both the custom endpoint and my account page.
I think its the way I added the endpoint which is creating all the issue, but I don’t know what. Pls help.