form-shipping.php 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. /**
  3. * Checkout shipping information form
  4. *
  5. * This template can be overridden by copying it to yourtheme/woocommerce/checkout/form-shipping.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. * @author WooThemes
  15. * @package WooCommerce/Templates
  16. * @version 3.0.9
  17. */
  18. if ( ! defined( 'ABSPATH' ) ) {
  19. exit; // Exit if accessed directly
  20. }
  21. ?>
  22. <div class="woocommerce-shipping-fields">
  23. <?php if ( true === WC()->cart->needs_shipping_address() ) : ?>
  24. <h3 id="ship-to-different-address">
  25. <label class="woocommerce-form__label woocommerce-form__label-for-checkbox checkbox">
  26. <input id="ship-to-different-address-checkbox" class="woocommerce-form__input woocommerce-form__input-checkbox input-checkbox" <?php checked( apply_filters( 'woocommerce_ship_to_different_address_checked', 'shipping' === get_option( 'woocommerce_ship_to_destination' ) ? 1 : 0 ), 1 ); ?> type="checkbox" name="ship_to_different_address" value="1" /> <span><?php _e( 'Ship to a different address?', 'woocommerce' ); ?></span>
  27. </label>
  28. </h3>
  29. <div class="shipping_address">
  30. <?php do_action( 'woocommerce_before_checkout_shipping_form', $checkout ); ?>
  31. <div class="woocommerce-shipping-fields__field-wrapper">
  32. <?php
  33. $fields = $checkout->get_checkout_fields( 'shipping' );
  34. foreach ( $fields as $key => $field ) {
  35. if ( isset( $field['country_field'], $fields[ $field['country_field'] ] ) ) {
  36. $field['country'] = $checkout->get_value( $field['country_field'] );
  37. }
  38. woocommerce_form_field( $key, $field, $checkout->get_value( $key ) );
  39. }
  40. ?>
  41. </div>
  42. <?php do_action( 'woocommerce_after_checkout_shipping_form', $checkout ); ?>
  43. </div>
  44. <?php endif; ?>
  45. </div>
  46. <div class="woocommerce-additional-fields">
  47. <?php do_action( 'woocommerce_before_order_notes', $checkout ); ?>
  48. <?php if ( apply_filters( 'woocommerce_enable_order_notes_field', 'yes' === get_option( 'woocommerce_enable_order_comments', 'yes' ) ) ) : ?>
  49. <?php if ( ! WC()->cart->needs_shipping() || wc_ship_to_billing_address_only() ) : ?>
  50. <h3><?php _e( 'Additional information', 'woocommerce' ); ?></h3>
  51. <?php endif; ?>
  52. <div class="woocommerce-additional-fields__field-wrapper">
  53. <?php foreach ( $checkout->get_checkout_fields( 'order' ) as $key => $field ) : ?>
  54. <?php woocommerce_form_field( $key, $field, $checkout->get_value( $key ) ); ?>
  55. <?php endforeach; ?>
  56. </div>
  57. <?php endif; ?>
  58. <?php do_action( 'woocommerce_after_order_notes', $checkout ); ?>
  59. </div>