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.woothemes.com/document/template-structure/ |
14
|
|
|
* @author WooThemes |
15
|
|
|
* @package WooCommerce/Templates |
16
|
|
|
* @version 2.2.0 |
17
|
|
|
*/ |
18
|
|
|
|
19
|
|
|
if ( ! defined( 'ABSPATH' ) ) { |
20
|
|
|
exit; // Exit if accessed directly |
21
|
|
|
} |
22
|
|
|
|
23
|
|
|
?> |
24
|
|
|
<div class="woocommerce-shipping-fields"> |
25
|
|
|
<?php if ( true === WC()->cart->needs_shipping_address() ) : ?> |
26
|
|
|
|
27
|
|
|
<h3 id="ship-to-different-address"> |
28
|
|
|
<label for="ship-to-different-address-checkbox" class="checkbox"><?php _e( 'Ship to a different address?', 'woocommerce' ); ?></label> |
29
|
|
|
<input id="ship-to-different-address-checkbox" class="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" /> |
30
|
|
|
</h3> |
31
|
|
|
|
32
|
|
|
<div class="shipping_address"> |
33
|
|
|
|
34
|
|
|
<?php do_action( 'woocommerce_before_checkout_shipping_form', $checkout ); ?> |
35
|
|
|
|
36
|
|
View Code Duplication |
<?php foreach ( $checkout->checkout_fields['shipping'] as $key => $field ) : ?> |
|
|
|
|
37
|
|
|
|
38
|
|
|
<?php woocommerce_form_field( $key, $field, $checkout->get_value( $key ) ); ?> |
39
|
|
|
|
40
|
|
|
<?php endforeach; ?> |
41
|
|
|
|
42
|
|
|
<?php do_action( 'woocommerce_after_checkout_shipping_form', $checkout ); ?> |
43
|
|
|
|
44
|
|
|
</div> |
45
|
|
|
|
46
|
|
|
<?php endif; ?> |
47
|
|
|
|
48
|
|
|
<?php do_action( 'woocommerce_before_order_notes', $checkout ); ?> |
49
|
|
|
|
50
|
|
|
<?php if ( apply_filters( 'woocommerce_enable_order_notes_field', get_option( 'woocommerce_enable_order_comments', 'yes' ) === 'yes' ) ) : ?> |
51
|
|
|
|
52
|
|
|
<?php if ( ! WC()->cart->needs_shipping() || wc_ship_to_billing_address_only() ) : ?> |
53
|
|
|
|
54
|
|
|
<h3><?php _e( 'Additional Information', 'woocommerce' ); ?></h3> |
55
|
|
|
|
56
|
|
|
<?php endif; ?> |
57
|
|
|
|
58
|
|
View Code Duplication |
<?php foreach ( $checkout->checkout_fields['order'] as $key => $field ) : ?> |
|
|
|
|
59
|
|
|
|
60
|
|
|
<?php woocommerce_form_field( $key, $field, $checkout->get_value( $key ) ); ?> |
61
|
|
|
|
62
|
|
|
<?php endforeach; ?> |
63
|
|
|
|
64
|
|
|
<?php endif; ?> |
65
|
|
|
|
66
|
|
|
<?php do_action( 'woocommerce_after_order_notes', $checkout ); ?> |
67
|
|
|
</div> |
68
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.