| 1 |
<?php |
| 2 |
/** |
| 3 |
* Classic (legacy) per-product subscription meta fields. |
| 4 |
* |
| 5 |
* Shared by the classic-only panel (product-form.php) and the simple-product |
| 6 |
* plan view's hidden "classic settings" pane (Admin/Product/Plans). The fields |
| 7 |
* are unchanged legacy inputs kept for backward compatibility; they always |
| 8 |
* submit with the product post save regardless of which view is visible. |
| 9 |
* |
| 10 |
* Expects in scope: $subscrpt_enabled, $timing_types, $subscrpt_timing, |
| 11 |
* $trial_timing_types, $subscrpt_trial_time, $subscrpt_trial_timing, |
| 12 |
* $subscrpt_cart_txt, $subscrpt_user_cancell, $subscrpt_limit. |
| 13 |
* |
| 14 |
* @package SpringDevs\Subscription\Admin |
| 15 |
*/ |
| 16 |
|
| 17 |
if ( ! defined( 'ABSPATH' ) ) { |
| 18 |
exit; |
| 19 |
} |
| 20 |
|
| 21 |
?> |
| 22 |
<input name="_subscript_nonce" type="hidden" value="<?php echo esc_attr( wp_create_nonce( '_subscript_edit_product_nonce' ) ); ?>"/> |
| 23 |
<strong style="margin: 10px;"><?php esc_html_e( 'Subscription Settings', 'subscription' ); ?></strong> |
| 24 |
<?php |
| 25 |
// The "Enable subscription" toggle lives in the shared toolbar above (see |
| 26 |
// Admin\Product\Plans::render_toolbar), so it is not repeated here. |
| 27 |
woocommerce_wp_select( |
| 28 |
array( |
| 29 |
'id' => 'subscrpt_timing', |
| 30 |
'label' => __( 'Users will pay', 'subscription' ), |
| 31 |
'value' => $subscrpt_timing, |
| 32 |
'options' => $timing_types, |
| 33 |
'description' => __( 'Set the length of each recurring subscription period to daily, weekly, monthly or annually.', 'subscription' ), |
| 34 |
'desc_tip' => true, |
| 35 |
) |
| 36 |
); |
| 37 |
?> |
| 38 |
<p class="form-field subscrpt_field"> |
| 39 |
<label for="subscrpt_trial_time"><?php esc_html_e( 'Free Trial Duration', 'subscription' ); ?></label> |
| 40 |
<input type="number" class="short" name="subscrpt_trial_time" id="subscrpt_trial_time" value="<?php echo esc_attr( $subscrpt_trial_time ); ?>"/> |
| 41 |
<select name="subscrpt_trial_timing" id="subscrpt_trial_timing"> |
| 42 |
<?php foreach ( $trial_timing_types as $timing_type ) : ?> |
| 43 |
<option value="<?php echo esc_attr( $timing_type['value'] ); ?>" |
| 44 |
<?php selected( $subscrpt_trial_timing, $timing_type['value'] ); ?> |
| 45 |
><?php echo esc_html( $timing_type['label'] ); ?></option> |
| 46 |
<?php endforeach; ?> |
| 47 |
</select> |
| 48 |
<small class="description"><?php esc_html_e( 'Let users try the subscription for free before the first payment is collected.', 'subscription' ); ?></small> |
| 49 |
</p> |
| 50 |
<?php |
| 51 |
woocommerce_wp_text_input( |
| 52 |
array( |
| 53 |
'id' => 'subscrpt_cart_txt', |
| 54 |
'label' => __( 'Button Text (Custom)', 'subscription' ), |
| 55 |
'type' => 'text', |
| 56 |
'value' => $subscrpt_cart_txt, |
| 57 |
'description' => __( 'Customize the button label shown on the product or shop page. Default is "Subscribe"', 'subscription' ), |
| 58 |
'desc_tip' => true, |
| 59 |
) |
| 60 |
); |
| 61 |
|
| 62 |
woocommerce_wp_select( |
| 63 |
array( |
| 64 |
'id' => 'subscrpt_user_cancel', |
| 65 |
'label' => __( 'Allow User Cancellation?', 'subscription' ), |
| 66 |
'value' => $subscrpt_user_cancell, |
| 67 |
'options' => array( |
| 68 |
'yes' => __( 'Yes', 'subscription' ), |
| 69 |
'no' => __( 'No', 'subscription' ), |
| 70 |
), |
| 71 |
'description' => __( 'Allow subscribers to cancel their subscription manually from their account dashboard.', 'subscription' ), |
| 72 |
'desc_tip' => true, |
| 73 |
) |
| 74 |
); |
| 75 |
|
| 76 |
woocommerce_wp_select( |
| 77 |
array( |
| 78 |
'id' => 'subscrpt_limit', |
| 79 |
'label' => __( 'Limit subscription', 'subscription' ), |
| 80 |
'options' => array( |
| 81 |
'unlimited' => __( 'Do not limit', 'subscription' ), |
| 82 |
'one' => __( 'allow only one active subscription', 'subscription' ), |
| 83 |
'only_one' => __( 'allow only one subscription of any status', 'subscription' ), |
| 84 |
), |
| 85 |
'value' => $subscrpt_limit, |
| 86 |
'description' => __( 'Set optional limits for this product subscription.', 'subscription' ), |
| 87 |
'desc_tip' => true, |
| 88 |
) |
| 89 |
); |
| 90 |
|