1

I am trying to remove the duration on the cart and checkout page for Woocommerce Subscriptions.

So instead of $99 / month for 12 months only $99 / month (${price} / {period})

The solution on the following topic removes the whole string after the price. Maybe it helps to find a solution for my case. (Remove WooCommerce subscription interval from cart and checkout pages)

Helpful resource: WooCommerce Subscriptions Filter Reference documentation

I hope someone can help me with this. Thank you

nvoy
  • 11
  • 4

1 Answers1

0
add_filter('wcs_cart_totals_order_total_html', 'modify_wcs_cart_totals_order_total_html', 100, 2);

function modify_wcs_cart_totals_order_total_html($order_total_html, $cart) {
    $recurring_total_string = explode('für', $order_total_html);
    $recurring_first_string = explode('Erste', $order_total_html);
    return $recurring_total_string[0]. '<div class="first-payment-date"><small>Erste'.$recurring_first_string[1].' </small></div>';
}
mujuonly
  • 11,370
  • 5
  • 45
  • 75
  • Unfortunatly this doesnt work. It still shows the duration – nvoy Feb 17 '22 at 22:41
  • @nvoy This will remove the specified string from the cart total in cart and checkout pages. – mujuonly Feb 18 '22 at 09:49
  • https://i.postimg.cc/PrrBTgKB/Screenshot-2022-02-18-120150.png Here is the screenshot with the filter in functions.php applied – nvoy Feb 18 '22 at 11:03
  • This worked just fine (https://i.postimg.cc/g04nxwfY/Screenshot-2022-02-18-124147.png). Is it possible to keep the "first payment on:" under the reccuring total (see first screenshot)? Thank you! – nvoy Feb 18 '22 at 11:43
  • In the staging environment it works like a charm. But the other strings still show it. Please see this screenshot to understand what it should look like: https://i.postimg.cc/zG8GhCp6/Screenshot-2022-02-18-151723.png Thank you very much! – nvoy Feb 18 '22 at 14:24