未捕获的错误:在WooCommerce form-checkout.php上调用成员函数is_registration_enabled()

时间:2018-10-14 05:58:41

标签: php wordpress woocommerce

我正在制作需要结帐表格的插件。当我包含form-checkout.php

时,出现错误提示
  

致命错误:未捕获错误:在C:\ xampp7 \ htdocs \ woo \ wp-content \ plugins \ wooinstant \ inc \ templates \ checkout \ form-checkout.php:28中调用成员函数is_registration_enabled()上的null堆栈跟踪:#0 C:\ xampp7 \ htdocs \ woo \ wp-content \ plugins \ wooinstant \ inc \ wooinstant-layout.php(19):include()#1 C:\ xampp7 \ htdocs \ woo \ wp-includes \ class-wp-hook.php(286):wooinstant_layout('')#2 C:\ xampp7 \ htdocs \ woo \ wp-includes \ class-wp-hook.php(310):WP_Hook-> apply_filters(NULL,阵列)#3 C:\ xampp7 \ htdocs \ woo \ wp-includes \ plugin.php(453):WP_Hook-> do_action(Array)#4 C:\ xampp7 \ htdocs \ woo \ wp-includes \ general-template。 php(2630):do_action('wp_footer')#5 C:\ xampp7 \ htdocs \ woo \ wp-content \ themes \ twentyseventeen \ footer.php(44):wp_footer()#6 C:\ xampp7 \ htdocs \ woo \ wp-includes \ template.php(688):require_once('C:\ xampp7 \ htdoc ...')#7 C:\ xampp7 \ htdocs \ woo \ wp-includes \ template.php(647):load_template( 'C:\ xampp7 \ htdoc ...',true)#8 C:\ xampp7 \ htdocs \ woo \ wp-includes \ general-template.php(76):locate_template(Array, true)#28上的C:\ xampp7 \ htdocs \ woo \ wp-content \ plugins \ wooinstant \ inc \ templates \ checkout \ form-checkout.php中的#9 C:\ xampp7 \ htdocs \ woo \ wp-con

Error

我要包含这样的结帐表单文件

include plugin_dir_path( __FILE__ ) . '/templates/checkout/form-checkout.php';

enter image description here

我不想在那里使用[woocommerce_checkout]

2 个答案:

答案 0 :(得分:0)

我通过使用navigationItem.searchController = searchController

解决了这个问题

enter image description here

答案 1 :(得分:0)

更新WooCommerce插件将会删除您的代码。取而代之的是,您可以尝试 wc_get_template_part 函数以包括结帐