Brak opisu

form-billing.php 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. /**
  3. * Checkout billing information form
  4. *
  5. * This template can be overridden by copying it to yourtheme/woocommerce/checkout/form-billing.php.
  6. *
  7. * HOWEVER, on occasion WooCommerce will need to update template files and you
  8. * (the theme developer) will need to copy the new files to your theme to
  9. * maintain compatibility. We try to do this as little as possible, but it does
  10. * happen. When this occurs the version of the template file will be bumped and
  11. * the readme will list any important changes.
  12. *
  13. * @see https://docs.woocommerce.com/document/template-structure/
  14. * @package WooCommerce\Templates
  15. * @version 3.6.0
  16. * @global WC_Checkout $checkout
  17. */
  18. defined( 'ABSPATH' ) || exit;
  19. ?>
  20. <div class="woocommerce-billing-fields">
  21. <?php if ( wc_ship_to_billing_address_only() && WC()->cart->needs_shipping() ) : ?>
  22. <h3><?php esc_html_e( 'Billing &amp; Shipping', 'woocommerce' ); ?></h3>
  23. <?php else : ?>
  24. <h3><?php esc_html_e( 'Billing details', 'woocommerce' ); ?></h3>
  25. <?php endif; ?>
  26. <?php do_action( 'woocommerce_before_checkout_billing_form', $checkout ); ?>
  27. <div class="woocommerce-billing-fields__field-wrapper">
  28. <?php
  29. $fields = $checkout->get_checkout_fields( 'billing' );
  30. foreach ( $fields as $key => $field ) {
  31. woocommerce_form_field( $key, $field, $checkout->get_value( $key ) );
  32. }
  33. ?>
  34. </div>
  35. <?php do_action( 'woocommerce_after_checkout_billing_form', $checkout ); ?>
  36. </div>
  37. <?php if ( ! is_user_logged_in() && $checkout->is_registration_enabled() ) : ?>
  38. <div class="woocommerce-account-fields">
  39. <?php if ( ! $checkout->is_registration_required() ) : ?>
  40. <p class="form-row form-row-wide create-account">
  41. <label class="woocommerce-form__label woocommerce-form__label-for-checkbox checkbox">
  42. <input class="woocommerce-form__input woocommerce-form__input-checkbox input-checkbox" id="createaccount" <?php checked( ( true === $checkout->get_value( 'createaccount' ) || ( true === apply_filters( 'woocommerce_create_account_default_checked', false ) ) ), true ); ?> type="checkbox" name="createaccount" value="1" /> <span><?php esc_html_e( 'Create an account?', 'woocommerce' ); ?></span>
  43. </label>
  44. </p>
  45. <?php endif; ?>
  46. <?php do_action( 'woocommerce_before_checkout_registration_form', $checkout ); ?>
  47. <?php if ( $checkout->get_checkout_fields( 'account' ) ) : ?>
  48. <div class="create-account">
  49. <?php foreach ( $checkout->get_checkout_fields( 'account' ) as $key => $field ) : ?>
  50. <?php woocommerce_form_field( $key, $field, $checkout->get_value( $key ) ); ?>
  51. <?php endforeach; ?>
  52. <div class="clear"></div>
  53. </div>
  54. <?php endif; ?>
  55. <?php do_action( 'woocommerce_after_checkout_registration_form', $checkout ); ?>
  56. </div>
  57. <?php endif; ?>