Нема описа

my-address.php 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. /**
  3. * My Addresses
  4. *
  5. * This template can be overridden by copying it to yourtheme/woocommerce/myaccount/my-address.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 2.6.0
  16. */
  17. defined( 'ABSPATH' ) || exit;
  18. $customer_id = get_current_user_id();
  19. if ( ! wc_ship_to_billing_address_only() && wc_shipping_enabled() ) {
  20. $get_addresses = apply_filters(
  21. 'woocommerce_my_account_get_addresses',
  22. array(
  23. 'billing' => __( 'Billing address', 'woocommerce' ),
  24. 'shipping' => __( 'Shipping address', 'woocommerce' ),
  25. ),
  26. $customer_id
  27. );
  28. } else {
  29. $get_addresses = apply_filters(
  30. 'woocommerce_my_account_get_addresses',
  31. array(
  32. 'billing' => __( 'Billing address', 'woocommerce' ),
  33. ),
  34. $customer_id
  35. );
  36. }
  37. $oldcol = 1;
  38. $col = 1;
  39. ?>
  40. <p>
  41. <?php echo apply_filters( 'woocommerce_my_account_my_address_description', esc_html__( 'The following addresses will be used on the checkout page by default.', 'woocommerce' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
  42. </p>
  43. <?php if ( ! wc_ship_to_billing_address_only() && wc_shipping_enabled() ) : ?>
  44. <div class="u-columns woocommerce-Addresses col2-set addresses">
  45. <?php endif; ?>
  46. <?php foreach ( $get_addresses as $name => $address_title ) : ?>
  47. <?php
  48. $address = wc_get_account_formatted_address( $name );
  49. $col = $col * -1;
  50. $oldcol = $oldcol * -1;
  51. ?>
  52. <div class="u-column<?php echo $col < 0 ? 1 : 2; ?> col-<?php echo $oldcol < 0 ? 1 : 2; ?> woocommerce-Address">
  53. <header class="woocommerce-Address-title title">
  54. <h3><?php echo esc_html( $address_title ); ?></h3>
  55. <a href="<?php echo esc_url( wc_get_endpoint_url( 'edit-address', $name ) ); ?>" class="edit"><?php echo $address ? esc_html__( 'Edit', 'woocommerce' ) : esc_html__( 'Add', 'woocommerce' ); ?></a>
  56. </header>
  57. <address>
  58. <?php
  59. echo $address ? wp_kses_post( $address ) : esc_html_e( 'You have not set up this type of address yet.', 'woocommerce' );
  60. ?>
  61. </address>
  62. </div>
  63. <?php endforeach; ?>
  64. <?php if ( ! wc_ship_to_billing_address_only() && wc_shipping_enabled() ) : ?>
  65. </div>
  66. <?php
  67. endif;