WooCommerce订阅和Yith我的帐户问题

时间:2019-07-15 19:39:01

标签: wordpress woocommerce woocommerce-subscriptions

致命错误:未捕获错误:调用成员函数get_status()为空

我安装了WooCommerce和WooCommerce订阅以及YITH WooCommerce自定义我的帐户页面。当我单击“查看订阅”时,我收到有关该网站出现问题的错误消息。当我在Chrome中显示控制台并/或启用调试时,会收到以下错误消息。任何帮助将不胜感激!

致命错误:未捕获错误:在/www/wp-content/plugins/woocommerce-subscriptions/templates/myaccount/subscription-details.php:18中,调用成员函数get_status()时为null堆栈跟踪:#0 / www / wp-content / plugins / woocommerce / includes / wc-core-functions.php(249):include()#1 / www / wp-content / plugins / woocommerce-subscriptions / includes / class-wcs-template-loader .php(41):wc_get_template('myaccount / subsc ...',Array,'','/ www / wp-content ...')#2 /wordpress/wp-includes/class-wp-hook.php (286):WCS_Template_Loader :: get_subscription_details_template(NULL)#3 /wordpress/wp-includes/class-wp-hook.php(310):WP_Hook-> apply_filters('',Array)#4 / wordpress / wp-includes / plugin.php(465):WP_Hook-> do_action(Array)#5 /www/wp-content/plugins/woocommerce-subscriptions/templates/myaccount/view-subscription.php(23):do_action('woocommerce_sub ...' ,NULL)#6 /www/wp-content/plugins/woocommerce/includes/wc-core-functions.php(249):include('/ www / wp-content ...')#7 / www / wp-内容/插件/ yith-woocommerce-c第18行上的/www/wp-content/plugins/woocommerce-subscriptions/templates/myaccount/subscription-details.php中的ustomize-myaccount-page / includes / functio

1 个答案:

答案 0 :(得分:1)

将此添加到您的view-subscription.php文件中:

Stilton

您可以在主题的woocommerce / myaccount文件夹中找到它。如果没有它,则必须通过从woocommerce安装中复制它来创建它(如果不确定其工作原理,请检查this link)。

该行应在安全检查之后进行:

$subscription = wcs_get_subscription(basename($_SERVER['REQUEST_URI']));