Woocommerce - 允许针对不同状态再次订购 [英] Woocommerce - Allowing Order Again for different statuses

查看:23
本文介绍了Woocommerce - 允许针对不同状态再次订购的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在所有状态下都可以使用 Order Again 功能.默认情况下,WooCommerce 仅允许状态为已完成此功能的订单.这似乎是一个两步过程,因为第一步需要向用户显示按钮,这是通过编辑此文件来完成的:

I'm looking to allow the Order Again functionality to all statuses. By default WooCommerce only allows orders with a status of COMPLETED this functionality. It seems to be a two step process as the first step requires the button being shown to the user, this is completed by editing this file:

wc-template-functions.php

用这段代码:

function woocommerce_order_again_button( $order ) {
        //if ( ! $order || ! $order->has_status( 'completed' ) || ! is_user_logged_in() ) {
        // Allow 'Order Again' at all times.
        if ( ! $order || ! is_user_logged_in() ) {
            return;
        }

        wc_get_template( 'order/order-again.php', array(
            'order' => $order
        ) );
    }

通过注释掉 $order->has_status() 方法的验证,我可以在页面上显示按钮.但是,当尝试单击再次订购"按钮时,它仍会在将商品添加到购物车之前进行检查.

By commenting out the validation of the $order->has_status() method, I'm able to show the button on the page. However, when trying clicking the Order Again button, it still does a check before adding the items to the cart.

谁能告诉我此代码存储在哪里以对 $order->has_status() 进行初步检查?

Can anyone tell me where this code is stored to do a preliminary check on the $order->has_status()?

推荐答案

对于那些有同样问题的人,这个插件能够完成我想要的:

For those having the same issue, this plugin was able to accomplish what I wanted:

https://wordpress.org/plugins/one-click-订购-重新订购/安装/

这篇关于Woocommerce - 允许针对不同状态再次订购的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆