Я использую следующий код для конкретных продуктов на основе подписки.
// 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;
}
Теперь я хочу отобразить период подписки после цены продукта, поэтому, например, если кто-то покупает продукт с ежемесячной подпиской, кнопка должна выглядеть (Платить 20 долларов в месяц).