I am trying to add text through functions.php
just after subscription-price">
I can do this with direct code editing, but need help to apply filter through functions.php
without changing orignal files.
$option_description = apply_filters( 'wcsatt_single_product_subscription_option_description', '<span class="' . $option_price_class . ' subscription-price">Text Here' . $sub_price_html . '</span>', $sub_price_html, $has_price_filter, false === $force_subscription, $product, $subscription_scheme ); $option = array( 'class' => 'subscription-option', 'value' => $scheme_key, 'selected' => $default_subscription_scheme_option_value === $scheme_key, 'description' => $option_description, 'data' => $option_data );
something like that
add_filter( 'wcsatt_single_product_subscription_option_description', 'add_custom_text_to_subscription_option'); function add_custom_text_to_subscription_option( $product) { }
Advertisement
Answer
This should suffice, basically anything you assign to the $option_descreption
variable will be displayed
Replace Your new text
in this answer, depending on your needs
function filter_wcsatt_single_product_subscription_option_description( $option_description, $sub_price_html, $has_price_filter, $force_subscription, $product, $subscription_scheme ) { // Class $option_price_class = 'subscription-option'; // New description $option_description = '<span class="' . $option_price_class . ' subscription-price">Your new Text ' . $sub_price_html . '</span>'; return $option_description; } add_filter( 'wcsatt_single_product_subscription_option_description', 'filter_wcsatt_single_product_subscription_option_description', 10, 6 );