billing-form-fields.php
1 day ago
billing.php
1 day ago
cart.php
10 months ago
checkout-billing-form-fields.php
1 day ago
checkout-details.php
1 day ago
checkout.php
1 day ago
order-placement-failed.php
8 months ago
order-placement-success.php
1 day ago
billing.php
48 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Settings Billing Address |
| 4 | * |
| 5 | * @package Tutor\Templates |
| 6 | * @author Themeum <support@themeum.com> |
| 7 | * @link https://themeum.com |
| 8 | * @since 4.0.0 |
| 9 | */ |
| 10 | |
| 11 | defined( 'ABSPATH' ) || exit; |
| 12 | |
| 13 | use Tutor\Ecommerce\BillingController; |
| 14 | |
| 15 | $default_values = BillingController::get_default_values(); |
| 16 | $country_state_options = BillingController::get_country_state_options(); |
| 17 | |
| 18 | $country_options = $country_state_options->country_options; |
| 19 | $state_mapping = $country_state_options->state_options; |
| 20 | |
| 21 | $billing_country = $default_values['billing_country'] ?? ''; |
| 22 | $initial_states = $state_mapping[ $billing_country ] ?? array(); |
| 23 | $form_id = $form_id ?? 'tutor-billing-address-form'; |
| 24 | ?> |
| 25 | |
| 26 | <section class="tutor-flex tutor-flex-column tutor-gap-4"> |
| 27 | <h5 class="tutor-h5 tutor-md-hidden"><?php echo esc_html__( 'Billing Address', 'tutor' ); ?></h5> |
| 28 | |
| 29 | <div class="tutor-card tutor-flex tutor-flex-column tutor-gap-5 tutor-border"> |
| 30 | <form |
| 31 | id="<?php echo esc_attr( $form_id ); ?>" |
| 32 | x-data="tutorForm({ |
| 33 | id: '<?php echo esc_attr( $form_id ); ?>', |
| 34 | mode: 'onChange', |
| 35 | shouldFocusError: true, |
| 36 | defaultValues: <?php echo esc_attr( wp_json_encode( $default_values ) ); ?>, |
| 37 | stateOptions: <?php echo esc_attr( wp_json_encode( $state_mapping ) ); ?> |
| 38 | })" |
| 39 | x-bind="getFormBindings()" |
| 40 | x-init="$watch('values.billing_country', () => !isResetting && setValue('billing_state', '', { shouldDirty: true }))" |
| 41 | @submit="handleSubmit((data) => handleSaveBillingInfo(data, '<?php echo esc_attr( $form_id ); ?>'))($event)" |
| 42 | class="tutor-flex tutor-flex-column tutor-gap-5" |
| 43 | > |
| 44 | <?php require tutor_get_template( 'ecommerce.billing-form-fields' ); ?> |
| 45 | </form> |
| 46 | </div> |
| 47 | </section> |
| 48 |