/** * Return an i18n'ified associative array of all time periods allowed for subscriptions. * * @param string $form Either 'singular' for singular trial periods or 'plural'. * @since 1.2 * @deprecated 2.0 */ public static function get_available_time_periods($form = 'singular') { _deprecated_function(__METHOD__, '2.0', 'wcs_get_available_time_periods( $form )'); return wcs_get_available_time_periods($form); }
?> "> <label for="variable_subscription_period[<?php echo esc_attr($loop); ?> ]" class="wcs_hidden_label"><?php esc_html_e('Subscription Trial Period', 'woocommerce-subscriptions'); ?> </label> <select name="variable_subscription_trial_period[<?php echo esc_attr($loop); ?> ]" class="wc_input_subscription_trial_period"> <?php foreach (wcs_get_available_time_periods() as $key => $value) { ?> <option value="<?php echo esc_attr($key); ?> " <?php selected($key, $chosen_trial_period); ?> ><?php echo esc_html($value); ?> </option> <?php } ?> </select>
/** * 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); }
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> <?php // Trial Length woocommerce_wp_text_input(array('id' => 'variable_subscription_trial_length[' . $loop . ']', 'class' => 'wc_input_subscription_trial_length', 'wrapper_class' => '_subscription_trial_length_field', 'label' => __('Free Trial', 'woocommerce-subscriptions'), 'placeholder' => _x('e.g. 3', 'example number of days / weeks / months', 'woocommerce-subscriptions'), 'value' => get_post_meta($variation->ID, '_subscription_trial_length', true))); // Trial Period woocommerce_wp_select(array('id' => 'variable_subscription_trial_period[' . $loop . ']', 'class' => 'wc_input_subscription_trial_period', 'wrapper_class' => '_subscription_trial_period_field', 'label' => __('Subscription Trial Period', 'woocommerce-subscriptions'), 'options' => wcs_get_available_time_periods(), 'description' => sprintf(_x('An optional period of time to wait before charging the first recurring payment. Any sign up fee will still be charged at the outset of the subscription. %s', 'Trial period dropdown\'s description in pricing fields', 'woocommerce-subscriptions'), self::get_trial_period_validation_message()), 'desc_tip' => true, 'value' => WC_Subscriptions_Product::get_trial_period($variation->ID))); ?> </td> </tr>