credit-card-fields.php
4 years ago
form-account-info-fields.php
3 months ago
form-billing-fields.php
4 years ago
form-checkout-sidebar.php
1 year ago
form-checkout-submit-btn.php
1 month ago
form-checkout.php
2 weeks ago
form-login.php
3 years ago
form-payment-methods.php
1 year ago
form-terms.php
10 months ago
group-selector.php
1 year ago
index.php
4 years ago
form-checkout-sidebar.php
163 lines
| 1 | <?php |
| 2 | |
| 3 | use ProfilePress\Core\Membership\Controllers\CheckoutSessionData; |
| 4 | use ProfilePress\Core\Membership\Models\Order\CartEntity; |
| 5 | use ProfilePress\Core\Membership\Models\Plan\PlanEntity; |
| 6 | use ProfilePress\Core\Membership\Models\Subscription\SubscriptionBillingFrequency; |
| 7 | use ProfilePress\Core\Membership\Models\Subscription\SubscriptionTrialPeriod; |
| 8 | use ProfilePress\Core\Membership\Services\Calculator; |
| 9 | use ProfilePress\Core\Membership\Services\TaxService; |
| 10 | |
| 11 | /** @global PlanEntity $plan */ |
| 12 | /** @global CartEntity $cart_vars */ |
| 13 | /** @global bool $isChangePlanIdSelected true if we on change plan checkout and selected plan is same as plan to switch from */ |
| 14 | |
| 15 | $coupon_code = CheckoutSessionData::get_coupon_code($plan->id); |
| 16 | |
| 17 | $tax_rate = ppress_session()->get(CheckoutSessionData::TAX_RATE); |
| 18 | if (empty($tax_rate)) $tax_rate = '0'; |
| 19 | |
| 20 | $sub_total = $cart_vars->sub_total; |
| 21 | $discount_amount = $cart_vars->discount_amount; |
| 22 | $discount_percentage = $cart_vars->discount_percentage; |
| 23 | $total_amount = $cart_vars->total; |
| 24 | |
| 25 | $billing_frequency = $plan->is_recurring() ? ' ' . SubscriptionBillingFrequency::get_label($plan->billing_frequency) : ''; |
| 26 | |
| 27 | ?> |
| 28 | <div class="ppress-checkout_order_summary-wrap"> |
| 29 | <?php do_action('ppress_checkout_summary_content_before'); ?> |
| 30 | <div class="ppress-checkout_order_summary"> |
| 31 | <div class="ppress-checkout_order_summary__plan_name"> |
| 32 | <?= $plan->name ?> |
| 33 | <span class="ppress-checkout_order_summary__plan_price">(<?= ppress_display_amount($plan->price) . $billing_frequency ?>)</span> |
| 34 | </div> |
| 35 | <?php if ( ! empty($plan->description)) : ?> |
| 36 | <div class="ppress-checkout_order_summary__plan_description"> |
| 37 | <?= $plan->description ?> |
| 38 | </div> |
| 39 | <?php endif; ?> |
| 40 | |
| 41 | <?php if ( ! $isChangePlanIdSelected) : ?> |
| 42 | <dl class="ppress-checkout_order_summary__bottom_details"> |
| 43 | |
| 44 | <?php if (apply_filters('ppress_checkout_show_discount', ppress_is_any_active_coupon())) : ?> |
| 45 | |
| 46 | <div class="ppress-checkout_order_summary__discount"> |
| 47 | <p> |
| 48 | <?php printf( |
| 49 | esc_html__('Have a coupon? %sClick here to enter your code%s', 'wp-user-avatar'), |
| 50 | '<a class="ppress-checkout__link ppress-coupon-code-link" href="#">', |
| 51 | '</a>' |
| 52 | ) ?> |
| 53 | </p> |
| 54 | |
| 55 | <div id="ppress-checkout-coupon-code-wrap"> |
| 56 | <div class="checkout_order_summary__discount__field_wrap"> |
| 57 | <input placeholder="<?php esc_html_e('Coupon code', 'wp-user-avatar') ?>" type="text" id="apply-discount" class="checkout_order_summary__discount__input"> |
| 58 | <input type="submit" class="ppress-apply-discount-btn" value="<?php esc_html_e('Apply', 'wp-user-avatar') ?>"> |
| 59 | </div> |
| 60 | </div> |
| 61 | </div> |
| 62 | <?php endif; ?> |
| 63 | |
| 64 | <?php if ($cart_vars->change_plan_sub_id > 0) : ?> |
| 65 | <div class="checkout_order_summary__fee_structure__item"> |
| 66 | <dt><?php esc_html_e('Prorated Price', 'wp-user-avatar'); ?></dt> |
| 67 | <dd><?= ppress_display_amount($cart_vars->prorated_price) ?></dd> |
| 68 | </div> |
| 69 | <?php endif; ?> |
| 70 | |
| 71 | <?php if ( ! Calculator::init($plan->signup_fee)->isNegativeOrZero()) : ?> |
| 72 | <div class="checkout_order_summary__fee_structure__item"> |
| 73 | <dt><?php esc_html_e('Signup Fee', 'wp-user-avatar') ?></dt> |
| 74 | <dd><?= ppress_display_amount($plan->signup_fee) ?></dd> |
| 75 | </div> |
| 76 | <?php endif; ?> |
| 77 | |
| 78 | <div class="checkout_order_summary__fee_structure__item"> |
| 79 | <dt><?php esc_html_e('Subtotal', 'wp-user-avatar') ?></dt> |
| 80 | <dd><?= ppress_display_amount($sub_total) ?></dd> |
| 81 | </div> |
| 82 | |
| 83 | <?php if ( ! empty($coupon_code)) : ?> |
| 84 | <div class="checkout_order_summary__fee_structure__item"> |
| 85 | <dt> |
| 86 | <?php printf( |
| 87 | esc_html__('Discount %s', 'wp-user-avatar'), |
| 88 | '<span>' . $coupon_code . '</span>' |
| 89 | ) ?> |
| 90 | </dt> |
| 91 | <dd>− |
| 92 | <?php if ( ! empty($discount_percentage)) : ?> |
| 93 | <?= $discount_percentage ?>% (<?= ppress_display_amount($discount_amount) ?>) |
| 94 | <?php else : ?> |
| 95 | <?= ppress_display_amount($discount_amount) ?> |
| 96 | <?php endif; ?> |
| 97 | <a id="ppress-remove-applied-coupon" href="#"><?= esc_html__('Remove', 'wp-user-avatar') ?></a> |
| 98 | </dd> |
| 99 | </div> |
| 100 | <?php endif; ?> |
| 101 | |
| 102 | <?php if (TaxService::init()->is_tax_enabled() && Calculator::init($cart_vars->tax_amount)->isGreaterThanZero()) : ?> |
| 103 | <div class="checkout_order_summary__fee_structure__item"> |
| 104 | <dt><?= TaxService::init()->get_tax_label(sanitize_text_field(ppressPOST_var('country', '', true))) ?> |
| 105 | <?php if ( ! empty($cart_vars->tax_rate)) : ?> |
| 106 | <span><?= $cart_vars->tax_rate ?>%</span> |
| 107 | <?php endif; ?> |
| 108 | </dt> |
| 109 | <dd><?= ppress_display_amount($cart_vars->tax_amount) ?></dd> |
| 110 | </div> |
| 111 | <?php endif; ?> |
| 112 | |
| 113 | <div class="checkout_order_summary__fee_structure__item"> |
| 114 | <dt> |
| 115 | <?php esc_html_e('Total', 'wp-user-avatar'); ?> |
| 116 | <?php if ($plan->has_free_trial()) : ?> |
| 117 | <span class="checkout_order_summary__fee_structure__item__trial_term"> |
| 118 | <?= SubscriptionTrialPeriod::get_label($plan->get_free_trial()) . ' ' . esc_html__('free trial', 'wp-user-avatar') ?> |
| 119 | </span> |
| 120 | <?php endif; ?> |
| 121 | </dt> |
| 122 | <dd><?= ppress_display_amount($total_amount) ?></dd> |
| 123 | </div> |
| 124 | </dl> |
| 125 | <?php endif; ?> |
| 126 | </div> |
| 127 | |
| 128 | <?php if ( ! $isChangePlanIdSelected) : ?> |
| 129 | <?php if ($plan->is_recurring()) : ?> |
| 130 | <div class="ppress-checkout_charge_details"> |
| 131 | <?php printf( |
| 132 | esc_html__('You will be charged %1$stoday%2$s', 'wp-user-avatar'), |
| 133 | sprintf('<span>%s ', ppress_display_amount($cart_vars->initial_amount)), '</span>', |
| 134 | ); |
| 135 | |
| 136 | if ($plan->is_auto_renew()) { |
| 137 | |
| 138 | echo ' '; |
| 139 | |
| 140 | printf( |
| 141 | esc_html__('then %1$s starting %2$s.', 'wp-user-avatar'), |
| 142 | sprintf('<span>%s %s</span>', ppress_display_amount($cart_vars->recurring_amount), strtolower(SubscriptionBillingFrequency::get_label($plan->billing_frequency))), |
| 143 | apply_filters('ppress_checkout_sidebar_order_expiration_date_time', ppress_format_date($cart_vars->expiration_date, 'j M, Y'), $cart_vars, $plan) |
| 144 | ); |
| 145 | } |
| 146 | |
| 147 | if ($plan->get_total_payments() > 0) { |
| 148 | printf(' ' . esc_html__('%s payments total.', 'wp-user-avatar'), '<strong>' . $plan->get_total_payments() . '</strong>'); |
| 149 | } |
| 150 | ?> |
| 151 | </div> |
| 152 | <?php elseif ( ! empty($cart_vars->expiration_date) && ppress_strtotime_utc($cart_vars->expiration_date) > 0) : ?> |
| 153 | <div class="ppress-checkout_charge_details"> |
| 154 | <?php printf( |
| 155 | esc_html__('After payment, your subscription will expire on %1$s', 'wp-user-avatar'), |
| 156 | '<span>' . ppress_format_date($cart_vars->expiration_date, 'j F, Y') . '</span>' |
| 157 | ); |
| 158 | ?> |
| 159 | </div> |
| 160 | <?php endif; ?> |
| 161 | <?php do_action('ppress_checkout_summary_content_after'); ?> |
| 162 | <?php endif; ?> |
| 163 | </div> |