I would like to remove (not just hide) the first payment date on the cart and checkout pages because it’s very confusing for my client.
I don’t find where and how to override the html output.
The information is added from a woocommerce subscription function (wcs-cart-functions.php) as following:
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 );
For obvious reasons, I don’t want to modify the core files.
What I’ve tried is to add a display:none in my theme CSS. It works but it just hides the information.
.woocommerce-checkout-review-order-table .first-payment-date {
display: none;
}
Thank you for your clues and ideas.
Fred
2
Answers
Well, as no one seems to have reached my question, I answer to myself with not a cleanest solution (in my opinion) and hoping there is no hidden side effect. I override the core function by creating a new one by reseting the html output:
I'd be glad if someone could point me to a better solution.
Copy that function to your function.php file and give it a different name (I added ‘_custom’ to mine). Make whatever changes you want to it.
Then add the following filters into function.php …
Hope that helps.