Woocommerce订阅,删除购物车和结帐页面上的首次付款日期

问题描述 投票:1回答:1

我想删除(而不是隐藏)购物车和结帐页面上的第一个付款日期,因为这对我的客户来说非常混乱。我找不到在哪里以及如何覆盖html输出。

该信息是从woocommerce订阅功能(wcs-cart-functions.php)中添加的,如下所示:

function wcs_add_cart_first_renewal_payment_date( $order_total_html, $cart ) {
    if ( 0 !== $cart->next_payment_date ) {
            $first_renewal_date = date_i18n( wc_date_format(), wcs_date_to_time( get_date_from_gmt( $cart->next_payment_date ) ) );
            // translators: placeholder is a date
            $order_total_html  .= '<div class="first-payment-date"><small>' . sprintf( __( 'First renewal: %s', 'woocommerce-subscriptions' ), $first_renewal_date ) .  '</small></div>';
        }

        return $order_total_html;
    }
    add_filter( 'wcs_cart_totals_order_total_html', 'wcs_add_cart_first_renewal_payment_date', 10, 2 );

出于明显的原因,我不想修改核心文件。

我尝试在主题CSS中添加display:none。它有效,但仅隐藏信息。

.woocommerce-checkout-review-order-table .first-payment-date {
    display: none;
}

谢谢您的线索和想法。弗雷德

php woocommerce checkout subscription
1个回答
0
投票
/* Hide information of first payment date by override order_total_html output */ add_filter( 'wcs_cart_totals_order_total_html', 'hide_first_renewal_payment_date', 100, 2 ); function hide_first_renewal_payment_date( $order_total_html, $cart ) { $order_total_html = ''; $value = '<strong>' . $cart->get_total() . '</strong> '; // If prices are tax inclusive, show taxes here if ( wc_tax_enabled() && $cart->tax_display_cart == 'incl' ) { $tax_string_array = array(); if ( get_option( 'woocommerce_tax_total_display' ) == 'itemized' ) { foreach ( $cart->get_tax_totals() as $code => $tax ) { $tax_string_array[] = sprintf( '%s %s', $tax->formatted_amount, $tax->label ); } } else { $tax_string_array[] = sprintf( '%s %s', wc_price( $cart->get_taxes_total( true, true ) ), WC()->countries->tax_or_vat() ); } if ( ! empty( $tax_string_array ) ) { // translators: placeholder is price string, denotes tax included in cart/order total $value .= '<small class="includes_tax">' . sprintf( _x( '(Includes %s)', 'includes tax', 'woocommerce-subscriptions' ), implode( ', ', $tax_string_array ) ) . '</small>'; } } $order_total_html .= $value; return $order_total_html; }

[如果有人能为我提供更好的解决方案,我会很高兴。

© www.soinside.com 2019 - 2024. All rights reserved.