小编Jei*_*eil的帖子

向在新窗口中打开的 Woocommerce 我的帐户订单添加操作按钮

我将从我的帐户订单中添加一个按钮,使其转到特定的网址。我制作了一个按钮,但我想用新窗口打开它而不是转到页面。我应该怎么办?下面是我添加的代码,我想用笼子打开这里的网址:

function sv_add_my_account_order_actions( $actions, $order ) {

    $actions['name'] = array(
        'url'  => 'the_action_url',
        'name' => 'The Button Text',
    );
    return $actions;
}
add_filter( 'woocommerce_my_account_my_orders_actions', 'sv_add_my_account_order_actions', 10, 2 );
Run Code Online (Sandbox Code Playgroud)

如何添加target="_blank"到每个附加的自定义按钮?

php wordpress jquery attributes woocommerce

4
推荐指数
1
解决办法
5395
查看次数

有条件地从 WooCommerce 我的帐户订单中删除取消按钮

当“付款方式标题”为“Npay”时,我想确保取消按钮在 my-account> my-order 中不可见。

“Npay”是一个外部支付网关,不适用于商业。因此,取消付款只能在外部完成。

add_filter('woocommerce_my_account_my_orders_actions', 'remove_my_cancel_button', 10, 2);
function remove_my_cancel_button($actions, $order){
    if ( $payment_method->has_title( 'Npay' ) ) {
        unset($actions['cancel']);
        return $actions;
    }
}
Run Code Online (Sandbox Code Playgroud)

php wordpress payment-gateway orders woocommerce

2
推荐指数
1
解决办法
1540
查看次数