woocommerce/templates/myaccount/my-address.php

82 lines
3.0 KiB
PHP
Raw Normal View History

2012-02-22 21:06:08 +00:00
<?php
/**
* My Addresses
2012-08-14 18:05:45 +00:00
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 1.6.4
2012-02-22 21:06:08 +00:00
*/
2012-08-14 18:05:45 +00:00
2012-02-22 21:06:08 +00:00
global $woocommerce;
$customer_id = get_current_user_id();
?>
<?php if (get_option('woocommerce_ship_to_billing_address_only')=='no') : ?>
2012-02-22 21:06:08 +00:00
<div class="col2-set addresses">
2012-08-14 18:05:45 +00:00
<div class="col-1">
2012-08-14 18:05:45 +00:00
<?php endif; ?>
2012-08-14 18:05:45 +00:00
<header class="title">
<h3><?php _e('Billing Address', 'woocommerce'); ?></h3>
2012-08-14 18:05:45 +00:00
<a href="<?php echo esc_url( add_query_arg('address', 'billing', get_permalink(woocommerce_get_page_id('edit_address'))) ); ?>" class="edit"><?php _e('Edit', 'woocommerce'); ?></a>
</header>
<address>
<?php
$address = array(
'first_name' => get_user_meta( $customer_id, 'billing_first_name', true ),
'last_name' => get_user_meta( $customer_id, 'billing_last_name', true ),
'company' => get_user_meta( $customer_id, 'billing_company', true ),
'address_1' => get_user_meta( $customer_id, 'billing_address_1', true ),
'address_2' => get_user_meta( $customer_id, 'billing_address_2', true ),
2012-08-14 18:05:45 +00:00
'city' => get_user_meta( $customer_id, 'billing_city', true ),
'state' => get_user_meta( $customer_id, 'billing_state', true ),
'postcode' => get_user_meta( $customer_id, 'billing_postcode', true ),
'country' => get_user_meta( $customer_id, 'billing_country', true )
);
2012-08-14 18:05:45 +00:00
$formatted_address = $woocommerce->countries->get_formatted_address( $address );
2012-08-14 18:05:45 +00:00
if (!$formatted_address) _e('You have not set up a billing address yet.', 'woocommerce'); else echo $formatted_address;
?>
</address>
2012-02-22 21:06:08 +00:00
<?php if (get_option('woocommerce_ship_to_billing_address_only')=='no') : ?>
2012-08-14 18:05:45 +00:00
</div><!-- /.col-1 -->
2012-08-14 18:05:45 +00:00
<div class="col-2">
2012-08-14 18:05:45 +00:00
<header class="title">
<h3><?php _e('Shipping Address', 'woocommerce'); ?></h3>
<a href="<?php echo esc_url( add_query_arg('address', 'shipping', get_permalink(woocommerce_get_page_id('edit_address'))) ); ?>" class="edit"><?php _e('Edit', 'woocommerce'); ?></a>
</header>
<address>
<?php
$address = array(
'first_name' => get_user_meta( $customer_id, 'shipping_first_name', true ),
'last_name' => get_user_meta( $customer_id, 'shipping_last_name', true ),
'company' => get_user_meta( $customer_id, 'shipping_company', true ),
'address_1' => get_user_meta( $customer_id, 'shipping_address_1', true ),
'address_2' => get_user_meta( $customer_id, 'shipping_address_2', true ),
2012-08-14 18:05:45 +00:00
'city' => get_user_meta( $customer_id, 'shipping_city', true ),
'state' => get_user_meta( $customer_id, 'shipping_state', true ),
'postcode' => get_user_meta( $customer_id, 'shipping_postcode', true ),
'country' => get_user_meta( $customer_id, 'shipping_country', true )
);
2012-08-14 18:05:45 +00:00
$formatted_address = $woocommerce->countries->get_formatted_address( $address );
2012-08-14 18:05:45 +00:00
if (!$formatted_address) _e('You have not set up a shipping address yet.', 'woocommerce'); else echo $formatted_address;
?>
</address>
2012-08-14 18:05:45 +00:00
</div><!-- /.col-2 -->
2012-08-14 18:05:45 +00:00
</div><!-- /.col2-set -->
2012-02-22 21:06:08 +00:00
<?php endif; ?>