Single month variation title is off
-
We are having a challenge when we do a monthly subscription where we set the subscription to a month. In the “Subtotal” section I can add a code snippet to change the “for month” to “per month” using a WooCommerce name. But, for the Totals portion it will not update the “For month” to “Per month”. The reason we are doing this is for a monthly Subscription model. Grammatically it looks for to show $20 for month. It should show as $20 per month. It would be fine for multiples but, that is not how we are using this. If I set the Subscription for X days it would me that it would very on when it would hit each month. The subtotal works… totals do not work.
Any suggestion on how I can accomplish this!
Sincerely,
PaulHere is the code I am using:
// Replace “for month” and “For month” in cart item subtotals
add_filter(‘woocommerce_cart_item_subtotal’, ‘update_subtotal_text’, 10, 3);function update_subtotal_text($subtotal, $cart_item, $cart_item_key) {
// Replace “for month” with “per month”
return str_replace([‘for month’, ‘For month’], [‘per month’, ‘Per month’], $subtotal);
}// Replace “for month” and “For month” in cart totals
add_filter(‘woocommerce_cart_item_totals’, ‘update_totals_text’, 10, 1);
//add_filter(‘woocommerce_cart_totals_html’, ‘update_totals_text’, 10, 1);function update_totals_text($cart_totals_html) {
// Replace “for month” with “per month”
return str_replace([‘for month’, ‘For month’], [‘per month’, ‘Per month’], $cart_totals_html);
}The page I need help with: [log in to see the link]
- You must be logged in to reply to this topic.