I'm using the following code to target specifically, subscription-based products.
// Display total amount on place order button
add_filter('woocommerce_order_button_text', 'subscriptions_custom_checkout_submit_button_text' );
function subscriptions_custom_checkout_submit_button_text( $order_button_text ) {
if ( WC_Subscriptions_Cart::cart_contains_subscription() ) {
$cart_total = WC()->cart->total;
return __('Pay $' . $cart_total, 'woocommerce');
} else {
// You can change it here for other products types in cart
# $order_button_text = __( 'Something here', 'woocommerce-subscriptions' );
}
return $order_button_text;
}
Now, I want to display the subscription period after the product price, so for example, if someone is purchasing a monthly subscription product, the button should read (Pay $20/Month).