/**
 * Creates a subscription price string from an array of subscription details. For example, "$5 / month for 12 months".
 *
 * @param array $subscription_details A set of name => value pairs for the subscription details to include in the string. Available keys:
 *		'initial_amount': The upfront payment for the subscription, including sign up fees, as a string from the @see wc_price(). Default empty string (no initial payment)
 *		'initial_description': The word after the initial payment amount to describe the amount. Examples include "now" or "initial payment". Defaults to "up front".
 *		'recurring_amount': The amount charged per period. Default 0 (no recurring payment).
 *		'subscription_interval': How regularly the subscription payments are charged. Default 1, meaning each period e.g. per month.
 *		'subscription_period': The temporal period of the subscription. Should be one of {day|week|month|year} as used by @see wcs_get_subscription_period_strings()
 *		'subscription_length': The total number of periods the subscription should continue for. Default 0, meaning continue indefinitely.
 *		'trial_length': The total number of periods the subscription trial period should continue for.  Default 0, meaning no trial period.
 *		'trial_period': The temporal period for the subscription's trial period. Should be one of {day|week|month|year} as used by @see wcs_get_subscription_period_strings()
 * @since 2.0
 * @return string The price string with translated and billing periods included
 */
function wcs_price_string($subscription_details)
{
    global $wp_locale;
    $subscription_details = wp_parse_args($subscription_details, array('currency' => '', 'initial_amount' => '', 'initial_description' => _x('up front', 'initial payment on a subscription', 'woocommerce-subscriptions'), 'recurring_amount' => '', 'subscription_interval' => 1, 'subscription_period' => '', 'subscription_length' => 0, 'trial_length' => 0, 'trial_period' => '', 'is_synced' => false, 'synchronised_payment_day' => 0, 'display_excluding_tax_label' => false));
    $subscription_details['subscription_period'] = strtolower($subscription_details['subscription_period']);
    // Make sure prices have been through wc_price()
    if (is_numeric($subscription_details['initial_amount'])) {
        $initial_amount_string = wc_price($subscription_details['initial_amount'], array('currency' => $subscription_details['currency'], 'ex_tax_label' => $subscription_details['display_excluding_tax_label']));
    } else {
        $initial_amount_string = $subscription_details['initial_amount'];
    }
    if (is_numeric($subscription_details['recurring_amount'])) {
        $recurring_amount_string = wc_price($subscription_details['recurring_amount'], array('currency' => $subscription_details['currency'], 'ex_tax_label' => $subscription_details['display_excluding_tax_label']));
    } else {
        $recurring_amount_string = $subscription_details['recurring_amount'];
    }
    $subscription_period_string = wcs_get_subscription_period_strings($subscription_details['subscription_interval'], $subscription_details['subscription_period']);
    $subscription_ranges = wcs_get_subscription_ranges();
    if ($subscription_details['subscription_length'] > 0 && $subscription_details['subscription_length'] == $subscription_details['subscription_interval']) {
        if (!empty($subscription_details['initial_amount'])) {
            if ($subscription_details['subscription_interval'] == $subscription_details['subscription_length'] && 0 == $subscription_details['trial_length']) {
                $subscription_string = $initial_amount_string;
            } else {
                // translators: 1$: initial amount, 2$: initial description (e.g. "up front"), 3$: recurring amount string (e.g. "£10 / month" )
                $subscription_string = sprintf(__('%1$s %2$s then %3$s', 'woocommerce-subscriptions'), $initial_amount_string, $subscription_details['initial_description'], $recurring_amount_string);
            }
        } else {
            $subscription_string = $recurring_amount_string;
        }
    } elseif (true === $subscription_details['is_synced'] && in_array($subscription_details['subscription_period'], array('week', 'month', 'year'))) {
        // Verbosity is important here to enable translation
        $payment_day = $subscription_details['synchronised_payment_day'];
        switch ($subscription_details['subscription_period']) {
            case 'week':
                $payment_day_of_week = WC_Subscriptions_Synchroniser::get_weekday($payment_day);
                if (1 == $subscription_details['subscription_interval']) {
                    if (!empty($subscription_details['initial_amount'])) {
                        // translators: 1$: initial amount, 2$: initial description (e.g. "up front"), 3$: recurring amount string, 4$: payment day of the week (e.g. "$15 up front, then $10 every Wednesday")
                        $subscription_string = sprintf(__('%1$s %2$s then %3$s every %4$s', 'woocommerce-subscriptions'), $initial_amount_string, $subscription_details['initial_description'], $recurring_amount_string, $payment_day_of_week);
                    } else {
                        // translators: 1$: recurring amount string, 2$: day of the week (e.g. "$10 every Wednesday")
                        $subscription_string = sprintf(__('%1$s every %2$s', 'woocommerce-subscriptions'), $recurring_amount_string, $payment_day_of_week);
                    }
                } else {
                    // e.g. $5 every 2 weeks on Wednesday
                    if (!empty($subscription_details['initial_amount'])) {
                        // translators: 1$: initial amount, 2$: initial description (e.g. "up front" ), 3$: recurring amount, 4$: interval (e.g. "2nd week"), 5$: day of the week (e.g. "Thursday"); (e.g. "$10 up front, then $20 every 2nd week on Wednesday")
                        $subscription_string = sprintf(__('%1$s %2$s then %3$s every %4%s on %5$s', 'woocommerce-subscriptions'), $initial_amount_string, $subscription_details['initial_description'], $recurring_amount_string, wcs_get_subscription_period_strings($subscription_details['subscription_interval'], $subscription_details['subscription_period']), $payment_day_of_week);
                    } else {
                        // translators: 1$: recurring amount string, 2$: interval (e.g. "2nd week"), 3$: day of the week (e.g. "Thursday"); (e.g. "$10 every 2nd week on Wednesday")
                        $subscription_string = sprintf(__('%1$s every %2$s on %3$s', 'woocommerce-subscriptions'), $recurring_amount_string, wcs_get_subscription_period_strings($subscription_details['subscription_interval'], $subscription_details['subscription_period']), $payment_day_of_week);
                    }
                }
                break;
            case 'month':
                if (1 == $subscription_details['subscription_interval']) {
                    // e.g. $15 on the 15th of each month
                    if (!empty($subscription_details['initial_amount'])) {
                        if ($payment_day > 27) {
                            // translators: 1$: initial amount, 2$: initial description (e.g. "up front"), 3$: recurring amount; (e.g. "$10 up front then $30 on the last day of each month")
                            $subscription_string = sprintf(__('%1$s %2$s then %3$s on the last day of each month', 'woocommerce-subscriptions'), $initial_amount_string, $subscription_details['initial_description'], $recurring_amount_string);
                        } else {
                            // translators: 1$: initial amount, 2$: initial description (e.g. "up front"), 3$: recurring amount, 4$: day of the month (e.g. "23rd"); (e.g. "$10 up front then $40 on the 23rd of each month")
                            $subscription_string = sprintf(__('%1$s %2$s then %3$s on the %4$s of each month', 'woocommerce-subscriptions'), $initial_amount_string, $subscription_details['initial_description'], $recurring_amount_string, WC_Subscriptions::append_numeral_suffix($payment_day));
                        }
                    } else {
                        if ($payment_day > 27) {
                            // translators: placeholder is recurring amount
                            $subscription_string = sprintf(__('%s on the last day of each month', 'woocommerce-subscriptions'), $recurring_amount_string);
                        } else {
                            // translators: 1$: recurring amount, 2$: day of the month (e.g. "23rd")
                            $subscription_string = sprintf(__('%1$s on the %2$s of each month', 'woocommerce-subscriptions'), $recurring_amount_string, WC_Subscriptions::append_numeral_suffix($payment_day));
                        }
                    }
                } else {
                    // e.g. $15 on the 15th of every 3rd month
                    if (!empty($subscription_details['initial_amount'])) {
                        if ($payment_day > 27) {
                            // translators: 1$: initial amount, 2$: initial description (e.g. "up front"), 3$: recurring amount, 4$: interval (e.g. "3rd")
                            $subscription_string = sprintf(__('%1$s %2$s then %3$s on the last day of every %4$s month', 'woocommerce-subscriptions'), $initial_amount_string, $subscription_details['initial_description'], $recurring_amount_string, WC_Subscriptions::append_numeral_suffix($subscription_details['subscription_interval']));
                        } else {
                            // translators: 1$: initial amount, 2$: initial description (e.g. "up front"), 3$: recurring amount, 4$: day of the month (e.g. "23rd"), 5$: interval (e.g. "3rd")
                            $subscription_string = sprintf(__('%1$s %2$s then %3$s on the %4$s day of every %5$s month', 'woocommerce-subscriptions'), $initial_amount_string, $subscription_details['initial_description'], $recurring_amount_string, WC_Subscriptions::append_numeral_suffix($payment_day), WC_Subscriptions::append_numeral_suffix($subscription_details['subscription_interval']));
                        }
                    } else {
                        if ($payment_day > 27) {
                            // translators: 1$: recurring amount, 2$: interval (e.g. "3rd")
                            $subscription_string = sprintf(__('%1$s on the last day of every %2$s month', 'woocommerce-subscriptions'), $recurring_amount_string, WC_Subscriptions::append_numeral_suffix($subscription_details['subscription_interval']));
                        } else {
                            // translators: 1$: recurring amount, 2$: day in month (e.g. "23rd"), 3$: interval (e.g. "3rd")
                            $subscription_string = sprintf(__('%1$s on the %2$s day of every %3$s month', 'woocommerce-subscriptions'), $recurring_amount_string, WC_Subscriptions::append_numeral_suffix($payment_day), WC_Subscriptions::append_numeral_suffix($subscription_details['subscription_interval']));
                        }
                    }
                }
                break;
            case 'year':
                if (1 == $subscription_details['subscription_interval']) {
                    // e.g. $15 on March 15th each year
                    if (!empty($subscription_details['initial_amount'])) {
                        // translators: 1$: initial amount, 2$: intial description (e.g. "up front"), 3$: recurring amount, 4$: month of year (e.g. "March"), 5$: day of the month (e.g. "23rd")
                        $subscription_string = sprintf(__('%1$s %2$s then %3$s on %4$s %5$s each year', 'woocommerce-subscriptions'), $initial_amount_string, $subscription_details['initial_description'], $recurring_amount_string, $wp_locale->month[$payment_day['month']], WC_Subscriptions::append_numeral_suffix($payment_day['day']));
                    } else {
                        // translators: 1$: recurring amount, 2$: month (e.g. "March"), 3$: day of the month (e.g. "23rd")
                        $subscription_string = sprintf(__('%1$s on %2$s %3$s each year', 'woocommerce-subscriptions'), $recurring_amount_string, $wp_locale->month[$payment_day['month']], WC_Subscriptions::append_numeral_suffix($payment_day['day']));
                    }
                } else {
                    // e.g. $15 on March 15th every 3rd year
                    if (!empty($subscription_details['initial_amount'])) {
                        // translators: 1$: initial amount, 2$: initial description (e.g. "up front"), 3$: recurring amount, 4$: month (e.g. "March"), 5$: day of the month (e.g. "23rd"), 6$: interval (e.g. "3rd")
                        $subscription_string = sprintf(__('%1$s %2$s then %3$s on %4$s %5$s every %6$s year', 'woocommerce-subscriptions'), $initial_amount_string, $subscription_details['initial_description'], $recurring_amount_string, $wp_locale->month[$payment_day['month']], WC_Subscriptions::append_numeral_suffix($payment_day['day']), WC_Subscriptions::append_numeral_suffix($subscription_details['subscription_interval']));
                    } else {
                        // translators: 1$: recurring amount, 2$: month (e.g. "March"), 3$: day of month (e.g. "23rd"), 4$: interval (e.g. "3rd")
                        $subscription_string = sprintf(__('%1$s on %2$s %3$s every %4$s year', 'woocommerce-subscriptions'), $recurring_amount_string, $wp_locale->month[$payment_day['month']], WC_Subscriptions::append_numeral_suffix($payment_day['day']), WC_Subscriptions::append_numeral_suffix($subscription_details['subscription_interval']));
                    }
                }
                break;
        }
    } elseif (!empty($subscription_details['initial_amount'])) {
        // translators: 1$: initial amount, 2$: initial description (e.g. "up front"), 3$: recurring amount, 4$: subscription period (e.g. "month" or "3 months")
        $subscription_string = sprintf(_n('%1$s %2$s then %3$s / %4$s', '%1$s %2$s then %3$s every %4$s', $subscription_details['subscription_interval'], 'woocommerce-subscriptions'), $initial_amount_string, $subscription_details['initial_description'], $recurring_amount_string, $subscription_period_string);
    } elseif (!empty($subscription_details['recurring_amount']) || intval($subscription_details['recurring_amount']) === 0) {
        // translators: 1$: recurring amount, 2$: subscription period (e.g. "month" or "3 months")
        $subscription_string = sprintf(_n('%1$s / %2$s', ' %1$s every %2$s', $subscription_details['subscription_interval'], 'woocommerce-subscriptions'), $recurring_amount_string, $subscription_period_string);
    } else {
        $subscription_string = '';
    }
    if ($subscription_details['subscription_length'] > 0) {
        // translators: 1$: subscription string (e.g. "$10 up front then $5 on March 23rd every 3rd year"), 2$: length (e.g. "4 years")
        $subscription_string = sprintf(__('%1$s for %2$s', 'woocommerce-subscriptions'), $subscription_string, $subscription_ranges[$subscription_details['subscription_period']][$subscription_details['subscription_length']]);
    }
    if ($subscription_details['trial_length'] > 0) {
        $trial_length = wcs_get_subscription_trial_period_strings($subscription_details['trial_length'], $subscription_details['trial_period']);
        if (!empty($subscription_details['initial_amount'])) {
            // translators: 1$: subscription string (e.g. "$10 up front then $5 on March 23rd every 3rd year"), 2$: trial length (e.g. "3 weeks")
            $subscription_string = sprintf(__('%1$s after %2$s free trial', 'woocommerce-subscriptions'), $subscription_string, $trial_length);
        } else {
            // translators: 1$: trial length (e.g. "3 weeks"), 2$: subscription string (e.g. "$10 up front then $5 on March 23rd every 3rd year")
            $subscription_string = sprintf(__('%1$s free trial then %2$s', 'woocommerce-subscriptions'), ucfirst($trial_length), $subscription_string);
        }
    }
    if ($subscription_details['display_excluding_tax_label'] && get_option('woocommerce_calc_taxes') == 'yes') {
        $subscription_string .= ' <small>' . WC()->countries->ex_tax_or_vat() . '</small>';
    }
    return apply_filters('woocommerce_subscription_price_string', $subscription_string, $subscription_details);
}
/**
 * Returns an array of allowed trial period lengths.
 *
 * @param string (optional) One of day, week, month or year. If empty, all subscription trial period lengths are returned.
 * @since 2.0
 */
function wcs_get_subscription_trial_lengths($subscription_period = '')
{
    $all_trial_periods = wcs_get_subscription_ranges();
    foreach ($all_trial_periods as $period => $trial_periods) {
        $all_trial_periods[$period][0] = _x('no', 'no trial period', 'woocommerce-subscriptions');
    }
    if (!empty($subscription_period)) {
        return $all_trial_periods[$subscription_period];
    } else {
        return $all_trial_periods;
    }
}
 /**
  * Load scripts and styles.
  *
  * @return void
  */
 public static function admin_scripts()
 {
     global $post;
     // Get admin screen id.
     $screen = get_current_screen();
     $screen_id = $screen ? $screen->id : '';
     $add_scripts = false;
     $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
     if (in_array($screen_id, array('edit-product', 'product'))) {
         $add_scripts = true;
         $writepanel_dependencies = array('jquery', 'jquery-ui-datepicker', 'wc-admin-meta-boxes', 'wc-admin-product-meta-boxes');
     } elseif ($screen_id === 'woocommerce_page_wc-settings' && isset($_GET['tab']) && $_GET['tab'] === 'subscriptions') {
         $add_scripts = true;
         $writepanel_dependencies = array('jquery', 'jquery-ui-datepicker');
     }
     if ($add_scripts) {
         wp_register_script('wcsatt_writepanel', WCS_ATT()->plugin_url() . '/assets/js/wcsatt-write-panels' . $suffix . '.js', $writepanel_dependencies, WCS_ATT::VERSION);
         wp_register_style('wcsatt_writepanel_css', WCS_ATT()->plugin_url() . '/assets/css/wcsatt-write-panels.css', array('woocommerce_admin_styles'), WCS_ATT::VERSION);
         wp_enqueue_style('wcsatt_writepanel_css');
     }
     // WooCommerce admin pages.
     if (in_array($screen_id, array('product', 'woocommerce_page_wc-settings'))) {
         wp_enqueue_script('wcsatt_writepanel');
         $params = array('add_subscription_scheme_nonce' => wp_create_nonce('wcsatt_add_subscription_scheme'), 'subscription_lengths' => wcs_get_subscription_ranges(), 'wc_ajax_url' => admin_url('admin-ajax.php'), 'post_id' => is_object($post) ? $post->ID : '', 'wc_plugin_url' => WC()->plugin_url());
         wp_localize_script('wcsatt_writepanel', 'wcsatt_admin_params', $params);
     }
 }
}
?>
<div class="wc-metaboxes-wrapper">

	<div id="billing-schedule">
		<?php 
if ($the_subscription->can_date_be_updated('next_payment')) {
    ?>
		<div class="billing-schedule-edit wcs-date-input"><?php 
    // Subscription Period Interval
    echo woocommerce_wp_select(array('id' => '_billing_interval', 'class' => 'billing_interval', 'label' => __('Recurring:', 'woocommerce-subscriptions'), 'value' => empty($the_subscription->billing_interval) ? 1 : $the_subscription->billing_interval, 'options' => wcs_get_subscription_period_interval_strings()));
    // Billing Period
    echo woocommerce_wp_select(array('id' => '_billing_period', 'class' => 'billing_period', 'label' => __('Billing Period:', 'woocommerce-subscriptions'), 'value' => empty($the_subscription->billing_period) ? 'month' : $the_subscription->billing_period, 'options' => wcs_get_subscription_period_strings()));
    ?>
			<input type="hidden" name="wcs-lengths" id="wcs-lengths" data-subscription_lengths="<?php 
    echo esc_attr(json_encode(wcs_get_subscription_ranges()));
    ?>
">
		</div>
		<?php 
} else {
    ?>
		<strong><?php 
    esc_html_e('Recurring:', 'woocommerce-subscriptions');
    ?>
</strong>
		<?php 
    printf('%s %s', esc_html(wcs_get_subscription_period_interval_strings($the_subscription->billing_interval)), esc_html(wcs_get_subscription_period_strings(1, $the_subscription->billing_period)));
    ?>
	<?php 
}
 /**
  * Returns either a string or array of strings describing the allowable trial period range
  * for a subscription.
  *
  * @since 1.0
  */
 public static function get_trial_period_validation_message($form = 'combined')
 {
     $subscription_ranges = wcs_get_subscription_ranges();
     if ('combined' == $form) {
         // translators: number of 1$: days, 2$: weeks, 3$: months, 4$: years
         $error_message = sprintf(__('The trial period can not exceed: %1s, %2s, %3s or %4s.', 'woocommerce-subscriptions'), array_pop($subscription_ranges['day']), array_pop($subscription_ranges['week']), array_pop($subscription_ranges['month']), array_pop($subscription_ranges['year']));
     } else {
         $error_message = array();
         foreach (wcs_get_available_time_periods() as $period => $string) {
             // translators: placeholder is a time period (e.g. "4 weeks")
             $error_message[$period] = sprintf(__('The trial period can not exceed %s.', 'woocommerce-subscriptions'), array_pop($subscription_ranges[$period]));
         }
     }
     return apply_filters('woocommerce_subscriptions_trial_period_validation_message', $error_message);
 }
 /**
  * Returns an array of subscription lengths.
  *
  * PayPal Standard Allowable Ranges
  * D – for days; allowable range is 1 to 90
  * W – for weeks; allowable range is 1 to 52
  * M – for months; allowable range is 1 to 24
  * Y – for years; allowable range is 1 to 5
  *
  * @param subscription_period string (optional) One of day, week, month or year. If empty, all subscription ranges are returned.
  * @since 1.0
  * @deprecated 2.0
  */
 public static function get_subscription_ranges($subscription_period = '')
 {
     _deprecated_function(__METHOD__, '2.0', 'wcs_get_subscription_ranges()');
     return wcs_get_subscription_ranges($subscription_period);
 }
 /**
  * Load scripts and styles.
  *
  * @return void
  */
 public static function admin_scripts()
 {
     global $post;
     $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
     // Get admin screen id
     $screen = get_current_screen();
     // Product metaboxes
     if (in_array($screen->id, array('edit-product', 'product'))) {
         wp_register_script('wcsatt_writepanel', WCS_ATT()->plugin_url() . '/assets/js/wcsatt-write-panels' . $suffix . '.js', array('jquery', 'jquery-ui-datepicker', 'wc-admin-meta-boxes', 'wc-admin-product-meta-boxes'), WCS_ATT::VERSION);
         wp_register_style('wcsatt_writepanel_css', WCS_ATT()->plugin_url() . '/assets/css/wcsatt-write-panels.css', array('woocommerce_admin_styles'), WCS_ATT::VERSION);
     }
     // WooCommerce admin pages
     if (in_array($screen->id, array('product'))) {
         wp_enqueue_script('wcsatt_writepanel');
         $params = array('add_subscription_scheme_nonce' => wp_create_nonce('wcsatt_add_subscription_scheme'), 'subscription_lengths' => wcs_get_subscription_ranges(), 'wc_ajax_url' => admin_url('admin-ajax.php'), 'post_id' => $post->ID, 'wc_plugin_url' => WC()->plugin_url());
         wp_localize_script('wcsatt_writepanel', 'wcsatt_admin_params', $params);
     }
     if (in_array($screen->id, array('edit-product', 'product'))) {
         wp_enqueue_style('wcsatt_writepanel_css');
     }
 }
 /**
  * Subscription scheme options displayed on the 'wcsatt_subscription_scheme_content' action.
  *
  * @param  int     $index
  * @param  array   $scheme_data
  * @param  int     $post_id
  * @return void
  */
 public static function subscription_scheme_content($index, $scheme_data, $post_id)
 {
     global $thepostid;
     if (empty($thepostid)) {
         $thepostid = '-1';
     }
     if (!empty($scheme_data)) {
         $subscription_period = $scheme_data['subscription_period'];
         $subscription_period_interval = $scheme_data['subscription_period_interval'];
         $subscription_length = $scheme_data['subscription_length'];
     } else {
         $subscription_period = 'month';
         $subscription_period_interval = '';
         $subscription_length = '';
     }
     // Subscription Period Interval
     woocommerce_wp_select(array('id' => '_subscription_period_interval', 'class' => 'wc_input_subscription_period_interval', 'label' => __('Subscription Periods', 'woocommerce-subscriptions'), 'value' => $subscription_period_interval, 'options' => wcs_get_subscription_period_interval_strings(), 'name' => 'wcsatt_schemes[' . $index . '][subscription_period_interval]'));
     // Billing Period
     woocommerce_wp_select(array('id' => '_subscription_period', 'class' => 'wc_input_subscription_period', 'label' => __('Billing Period', 'woocommerce-subscriptions'), 'value' => $subscription_period, 'description' => _x('for', 'for in "Every month _for_ 12 months"', 'woocommerce-subscriptions'), 'options' => wcs_get_subscription_period_strings(), 'name' => 'wcsatt_schemes[' . $index . '][subscription_period]'));
     // Subscription Length
     woocommerce_wp_select(array('id' => '_subscription_length', 'class' => 'wc_input_subscription_length', 'label' => __('Subscription Length', 'woocommerce-subscriptions'), 'value' => $subscription_length, 'options' => wcs_get_subscription_ranges($subscription_period), 'name' => 'wcsatt_schemes[' . $index . '][subscription_length]'));
 }
		</select>
	</p>
	<p class="form-row form-row-last show_if_variable-subscription _subscription_length_field">
		<label for="variable_subscription_length[<?php 
echo esc_attr($loop);
?>
]"><?php 
esc_html_e('Subscription Length:', 'woocommerce-subscriptions');
?>
</label>
		<select name="variable_subscription_length[<?php 
echo esc_attr($loop);
?>
]" class="wc_input_subscription_length">
		<?php 
foreach (wcs_get_subscription_ranges($subscription_period) as $key => $value) {
    ?>
			<option value="<?php 
    echo esc_attr($key);
    ?>
" <?php 
    selected($key, $chosen_length);
    ?>
><?php 
    echo esc_html($value);
    ?>
</option>
		<?php 
}
?>
		</select>
 /**
  * Returns a string representing the details of the subscription.
  *
  * For example "$20 per Month for 3 Months with a $10 sign-up fee".
  *
  * @param WC_Product|int $product A WC_Product object or ID of a WC_Product.
  * @param array $inclusions An associative array of flags to indicate how to calculate the price and what to include, values:
  *			'tax_calculation'     => false to ignore tax, 'include_tax' or 'exclude_tax' To indicate that tax should be added or excluded respectively
  *			'subscription_length' => true to include subscription's length (default) or false to exclude it
  *			'sign_up_fee'         => true to include subscription's sign up fee (default) or false to exclude it
  *			'price'               => string a price to short-circuit the price calculations and use in a string for the product
  * @since 1.0
  */
 public static function get_price_string($product, $include = array())
 {
     global $wp_locale;
     if (!is_object($product)) {
         $product = WC_Subscriptions::get_product($product);
     }
     if (!self::is_subscription($product)) {
         return;
     }
     $include = wp_parse_args($include, array('tax_calculation' => get_option('woocommerce_tax_display_shop'), 'subscription_price' => true, 'subscription_period' => true, 'subscription_length' => true, 'sign_up_fee' => true, 'trial_length' => true));
     $include = apply_filters('woocommerce_subscriptions_product_price_string_inclusions', $include, $product);
     $base_price = self::get_price($product);
     if (true === $include['sign_up_fee']) {
         $sign_up_fee = self::get_sign_up_fee($product);
     } elseif (false !== $include['sign_up_fee']) {
         // Allow override of product's sign-up fee
         $sign_up_fee = $include['sign_up_fee'];
     } else {
         $sign_up_fee = 0;
     }
     if (false != $include['tax_calculation']) {
         if (in_array($include['tax_calculation'], array('exclude_tax', 'excl'))) {
             // Subtract Tax
             if (isset($include['price'])) {
                 $price = $include['price'];
             } else {
                 $price = $product->get_price_excluding_tax(1, $include['price']);
             }
             if (true === $include['sign_up_fee']) {
                 $sign_up_fee = self::get_sign_up_fee_excluding_tax($product);
             }
         } else {
             // Add Tax
             if (isset($include['price'])) {
                 $price = $include['price'];
             } else {
                 $price = $product->get_price_including_tax();
             }
             if (true === $include['sign_up_fee']) {
                 $sign_up_fee = self::get_sign_up_fee_including_tax($product);
             }
         }
     } else {
         if (isset($include['price'])) {
             $price = $include['price'];
         } else {
             $price = wc_price($base_price);
         }
     }
     $price .= ' <span class="subscription-details">';
     $billing_interval = self::get_interval($product);
     $billing_period = self::get_period($product);
     $subscription_length = self::get_length($product);
     $trial_length = self::get_trial_length($product);
     $trial_period = self::get_trial_period($product);
     if (is_numeric($sign_up_fee)) {
         $sign_up_fee = wc_price($sign_up_fee);
     }
     if ($include['subscription_length']) {
         $ranges = wcs_get_subscription_ranges($billing_period);
     }
     if ($include['subscription_length'] && 0 != $subscription_length) {
         $include_length = true;
     } else {
         $include_length = false;
     }
     $subscription_string = '';
     if ($include['subscription_price'] && $include['subscription_period']) {
         // Allow extensions to not show price or billing period e.g. Name Your Price
         if ($include_length && $subscription_length == $billing_interval) {
             $subscription_string = $price;
             // Only for one billing period so show "$5 for 3 months" instead of "$5 every 3 months for 3 months"
         } elseif (WC_Subscriptions_Synchroniser::is_product_synced($product) && in_array($billing_period, array('week', 'month', 'year'))) {
             $payment_day = WC_Subscriptions_Synchroniser::get_products_payment_day($product);
             switch ($billing_period) {
                 case 'week':
                     $payment_day_of_week = WC_Subscriptions_Synchroniser::get_weekday($payment_day);
                     if (1 == $billing_interval) {
                         // translators: 1$: recurring amount string, 2$: day of the week (e.g. "$10 every Wednesday")
                         $subscription_string = sprintf(__('%1$s every %2$s', 'woocommerce-subscriptions'), $price, $payment_day_of_week);
                     } else {
                         // translators: 1$: recurring amount string, 2$: period, 3$: day of the week (e.g. "$10 every 2nd week on Wednesday")
                         $subscription_string = sprintf(__('%1$s every %2$s on %3$s', 'woocommerce-subscriptions'), $price, wcs_get_subscription_period_strings($billing_interval, $billing_period), $payment_day_of_week);
                     }
                     break;
                 case 'month':
                     if (1 == $billing_interval) {
                         if ($payment_day > 27) {
                             // translators: placeholder is recurring amount
                             $subscription_string = sprintf(__('%s on the last day of each month', 'woocommerce-subscriptions'), $price);
                         } else {
                             // translators: 1$: recurring amount, 2$: day of the month (e.g. "23rd") (e.g. "$5 every 23rd of each month")
                             $subscription_string = sprintf(__('%1$s on the %2$s of each month', 'woocommerce-subscriptions'), $price, WC_Subscriptions::append_numeral_suffix($payment_day));
                         }
                     } else {
                         if ($payment_day > 27) {
                             // translators: 1$: recurring amount, 2$: interval (e.g. "3rd") (e.g. "$10 on the last day of every 3rd month")
                             $subscription_string = sprintf(__('%1$s on the last day of every %2$s month', 'woocommerce-subscriptions'), $price, WC_Subscriptions::append_numeral_suffix($billing_interval));
                         } else {
                             // translators: 1$: <price> on the, 2$: <date> day of every, 3$: <interval> month (e.g. "$10 on the 23rd day of every 2nd month")
                             $subscription_string = sprintf(__('%1$s on the %2$s day of every %3$s month', 'woocommerce-subscriptions'), $price, WC_Subscriptions::append_numeral_suffix($payment_day), WC_Subscriptions::append_numeral_suffix($billing_interval));
                         }
                     }
                     break;
                 case 'year':
                     if (1 == $billing_interval) {
                         // translators: 1$: <price> on, 2$: <date>, 3$: <month> each year (e.g. "$15 on March 15th each year")
                         $subscription_string = sprintf(__('%1$s on %2$s %3$s each year', 'woocommerce-subscriptions'), $price, $wp_locale->month[$payment_day['month']], WC_Subscriptions::append_numeral_suffix($payment_day['day']));
                     } else {
                         // translators: 1$: recurring amount, 2$: month (e.g. "March"), 3$: day of the month (e.g. "23rd") (e.g. "$15 on March 15th every 3rd year")
                         $subscription_string = sprintf(__('%1$s on %2$s %3$s every %4$s year', 'woocommerce-subscriptions'), $price, $wp_locale->month[$payment_day['month']], WC_Subscriptions::append_numeral_suffix($payment_day['day']), WC_Subscriptions::append_numeral_suffix($billing_interval));
                     }
                     break;
             }
         } else {
             // translators: 1$: recurring amount, 2$: subscription period (e.g. "month" or "3 months") (e.g. "$15 / month" or "$15 every 2nd month")
             $subscription_string = sprintf(_n('%1$s / %2$s', ' %1$s every %2$s', $billing_interval, 'woocommerce-subscriptions'), $price, wcs_get_subscription_period_strings($billing_interval, $billing_period));
         }
     } elseif ($include['subscription_price']) {
         $subscription_string = $price;
     } elseif ($include['subscription_period']) {
         // translators: billing period (e.g. "every week")
         $subscription_string = sprintf(__('every %s', 'woocommerce-subscriptions'), wcs_get_subscription_period_strings($billing_interval, $billing_period));
     }
     // Add the length to the end
     if ($include_length) {
         // translators: 1$: subscription string (e.g. "$10 up front then $5 on March 23rd every 3rd year"), 2$: length (e.g. "4 years")
         $subscription_string = sprintf(__('%1$s for %2$s', 'woocommerce-subscriptions'), $subscription_string, $ranges[$subscription_length]);
     }
     if ($include['trial_length'] && 0 != $trial_length) {
         $trial_string = wcs_get_subscription_trial_period_strings($trial_length, $trial_period);
         // translators: 1$: subscription string (e.g. "$15 on March 15th every 3 years for 6 years"), 2$: trial length (e.g.: "with 4 months free trial")
         $subscription_string = sprintf(__('%1$s with %2$s free trial', 'woocommerce-subscriptions'), $subscription_string, $trial_string);
     }
     if ($include['sign_up_fee'] && self::get_sign_up_fee($product) > 0) {
         // translators: 1$: subscription string (e.g. "$15 on March 15th every 3 years for 6 years with 2 months free trial"), 2$: signup fee price (e.g. "and a $30 sign-up fee")
         $subscription_string = sprintf(__('%1$s and a %2$s sign-up fee', 'woocommerce-subscriptions'), $subscription_string, $sign_up_fee);
     }
     $subscription_string .= '</span>';
     return apply_filters('woocommerce_subscriptions_product_price_string', $subscription_string, $product, $include);
 }
	<td colspan="2">
		<label>
			<?php 
// translators: placeholder is a currency symbol / code
printf(esc_html__('Subscription Price (%s)', 'woocommerce-subscriptions'), esc_html(get_woocommerce_currency_symbol()));
?>
		</label>
		<?php 
// Subscription Price
woocommerce_wp_text_input(array('id' => 'variable_subscription_price[' . $loop . ']', 'class' => 'wc_input_subscription_price', 'wrapper_class' => '_subscription_price_field', 'label' => sprintf(__('Subscription Price (%s)', 'woocommerce-subscriptions'), get_woocommerce_currency_symbol()), 'placeholder' => _x('e.g. 9.90', 'example price', 'woocommerce-subscriptions'), 'value' => get_post_meta($variation->ID, '_subscription_price', true), 'type' => 'number', 'custom_attributes' => array('step' => 'any', 'min' => '0')));
// Subscription Period Interval
woocommerce_wp_select(array('id' => 'variable_subscription_period_interval[' . $loop . ']', 'class' => 'wc_input_subscription_period_interval', 'wrapper_class' => '_subscription_period_interval_field', 'label' => __('Subscription Periods', 'woocommerce-subscriptions'), 'options' => wcs_get_subscription_period_interval_strings(), 'value' => get_post_meta($variation->ID, '_subscription_period_interval', true)));
// Billing Period
woocommerce_wp_select(array('id' => 'variable_subscription_period[' . $loop . ']', 'class' => 'wc_input_subscription_period', 'wrapper_class' => '_subscription_period_field', 'label' => __('Billing Period', 'woocommerce-subscriptions'), 'value' => $subscription_period, 'description' => _x('for', 'Edit product screen, between the Billing Period and Subscription Length dropdowns', 'woocommerce-subscriptions'), 'options' => wcs_get_subscription_period_strings()));
// Subscription Length
woocommerce_wp_select(array('id' => 'variable_subscription_length[' . $loop . ']', 'class' => 'wc_input_subscription_length', 'wrapper_class' => '_subscription_length_field', 'label' => __('Subscription Length', 'woocommerce-subscriptions'), 'options' => wcs_get_subscription_ranges($subscription_period), 'value' => get_post_meta($variation->ID, '_subscription_length', true)));
?>
	</td>
</tr>
<tr class="variable_subscription_trial show_if_variable-subscription variable_subscription_trial_sign_up">
	<td class="sign-up-fee-cell show_if_variable-subscription">
<?php 
// Sign-up Fee
woocommerce_wp_text_input(array('id' => 'variable_subscription_sign_up_fee[' . $loop . ']', 'class' => 'wc_input_subscription_intial_price', 'wrapper_class' => '_subscription_sign_up_fee_field', 'label' => sprintf(__('Sign-up Fee (%s)', 'woocommerce-subscriptions'), get_woocommerce_currency_symbol()), 'placeholder' => _x('e.g. 9.90', 'example price', 'woocommerce-subscriptions'), 'value' => get_post_meta($variation->ID, '_subscription_sign_up_fee', true), 'type' => 'number', 'custom_attributes' => array('step' => 'any', 'min' => '0')));
?>
	</td>
	<td colspan="1" class="show_if_variable-subscription">
		<label><?php 
esc_html_e('Free Trial', 'woocommerce-subscriptions');
?>
</label>