Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wordpress 谁能告诉我如何卸下';继续结帐';我的网站上购物车页面的按钮_Wordpress_Checkout - Fatal编程技术网

Wordpress 谁能告诉我如何卸下';继续结帐';我的网站上购物车页面的按钮

Wordpress 谁能告诉我如何卸下';继续结帐';我的网站上购物车页面的按钮,wordpress,checkout,Wordpress,Checkout,我只想让贝宝结账,这是工作,但继续结帐按钮造成麻烦。 我已经尝试在我的子主题上向functions.php添加代码,如下所示- remove_action( 'woocommerce_proceed_to_checkout','woocommerce_button_proceed_to_checkout', 20); 但它不起作用。感谢您的帮助。remove\u action是个好主意,可能您的子主题或functions.php有问题。也许这个函数会在再次添加它的函数出现之前被调用 您可以尝试

我只想让贝宝结账,这是工作,但继续结帐按钮造成麻烦。 我已经尝试在我的子主题上向functions.php添加代码,如下所示-

remove_action( 'woocommerce_proceed_to_checkout','woocommerce_button_proceed_to_checkout', 20);

但它不起作用。感谢您的帮助。

remove\u action
是个好主意,可能您的子主题或functions.php有问题。也许这个函数会在再次添加它的函数出现之前被调用

您可以尝试使用CSS和按钮的类隐藏按钮。将其放入子主题的style.css中:

.wc-proceed-to-checkout { display: none !important; }
另一种方法是更改购物车的模板,这样就不会插入任何按钮

这需要一个查看步骤的视图

首先使用以下代码创建一个插件(如果您不知道如何创建,请参见我的答案:):

/*****************************************************************************************************************
/**
* Override WooCommerce templates with plugin
*/

add_filter( 'woocommerce_locate_template', 'woo_adon_plugin_template', 1, 3 );
    function woo_adon_plugin_template( $template, $template_name, $template_path ) {
        global $woocommerce;
        $_template = $template;
        if ( ! $template_path ) 
            $template_path = $woocommerce->template_url;
    
        $plugin_path  = untrailingslashit( plugin_dir_path( __FILE__ ) )  . '/templates/';
    
        // Look within the theme - has priority
        $template = locate_template(
        array(
        $template_path . $template_name,
        $template_name
        )
    );
    
    if( ! $template && file_exists( $plugin_path . $template_name ) )
        $template = $plugin_path . $template_name;
    
    if ( ! $template )
        $template = $_template;

    return $template;
}
在您的新插件文件夹中,在插件php文件旁边放置一个名为“templates”的文件夹,并在该文件夹中放置另一个名为
cart
的文件夹

现在转到woocommerce插件文件夹wp content->plugins->woocommerce->templates->cart->并复制继续到checkout-button.php

将php文件插入自定义插件的
cart
文件夹中。 现在可以删除按钮的标记

然后保存文件

如果现在激活插件,插件中的文件将覆盖woocommerce的默认文件。因此,按钮将丢失