【问题标题】:WooCommerce Subscriptions and Yith My Account IssuesWooCommerce 订阅和 Yith 我的帐户问题
【发布时间】:2019-11-24 12:53:43
【问题描述】:

致命错误:未捕获的错误:在 null 上调用成员函数 get_status()

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

致命错误:未捕获的错误:在 /www/wp-content/plugins/woocommerce-subscriptions/templates/myaccount/subscription-details.php:18 中调用 null 时的成员函数 get_status() 堆栈跟踪:#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 ustomize-myaccount-page/includes/functio 在 /www/wp-content/plugins/woocommerce-subscriptions/templates/myaccount/subscription-details.php 第 18 行

【问题讨论】:

    标签: wordpress woocommerce woocommerce-subscriptions


    【解决方案1】:

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

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

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

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

    if ( ! defined( 'ABSPATH' ) ) {
            exit; // Exit if accessed directly
    }
    

    【讨论】:

      猜你喜欢
      • 2018-04-04
      • 2015-11-30
      • 1970-01-01
      • 2021-06-19
      • 2021-05-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-12
      相关资源
      最近更新 更多