【问题标题】:WooCommerce hide pay button on my account page for failed/onhold ordersWooCommerce 在我的帐户页面上隐藏失败/暂停订单的付款按钮
【发布时间】:2020-08-20 23:27:10
【问题描述】:

在“我的帐户”页面上隐藏失败或保留订单的支付按钮的正确 CSS 代码是什么?

我试过了,但它不起作用。

.woocommerce-button.button.pay {
    display: none;
}

谢谢。

【问题讨论】:

    标签: php css wordpress woocommerce


    【解决方案1】:

    您可以使用以下内容:

    • CSS
    .woocommerce-MyAccount-content .woocommerce-orders-table__row--status-failed .pay {
        display: none;
    }
    
    • PHP
    function filter_woocommerce_my_account_my_orders_actions( $actions, $order ) {
        // Get status
        $order_status = $order->get_status();
    
        // Status = failed
        if ( $order_status == 'failed' ) {
            // Unset 
            unset( $actions['pay'] );
        }
    
        return $actions;
    }
    add_filter( 'woocommerce_my_account_my_orders_actions', 'filter_woocommerce_my_account_my_orders_actions', 10, 2 );
    

    【讨论】:

      猜你喜欢
      • 2021-01-17
      • 2021-02-17
      • 2017-06-27
      • 2022-01-19
      • 1970-01-01
      • 2021-06-05
      • 2020-12-20
      • 2021-02-21
      • 1970-01-01
      相关资源
      最近更新 更多