diff --git a/PLAN.md b/PLAN.md index 97be652..f3e3fe3 100644 --- a/PLAN.md +++ b/PLAN.md @@ -600,29 +600,29 @@ Track completion per file. Mark with `[x]` when done. ### Phase 6 -- My Account -- [ ] `myaccount/my-account.html.twig` -- [ ] `myaccount/navigation.html.twig` -- [ ] `myaccount/dashboard.html.twig` -- [ ] `myaccount/orders.html.twig` -- [ ] `myaccount/view-order.html.twig` -- [ ] `myaccount/my-address.html.twig` -- [ ] `myaccount/form-edit-address.html.twig` -- [ ] `myaccount/form-edit-account.html.twig` -- [ ] `myaccount/downloads.html.twig` -- [ ] `myaccount/payment-methods.html.twig` -- [ ] `myaccount/form-add-payment-method.html.twig` -- [ ] `myaccount/form-login.html.twig` -- [ ] `myaccount/form-lost-password.html.twig` -- [ ] `myaccount/form-reset-password.html.twig` -- [ ] `myaccount/lost-password-confirmation.html.twig` +- [x] `myaccount/my-account.html.twig` +- [x] `myaccount/navigation.html.twig` +- [x] `myaccount/dashboard.html.twig` +- [x] `myaccount/orders.html.twig` +- [x] `myaccount/view-order.html.twig` +- [x] `myaccount/my-address.html.twig` +- [x] `myaccount/form-edit-address.html.twig` +- [x] `myaccount/form-edit-account.html.twig` +- [x] `myaccount/downloads.html.twig` +- [x] `myaccount/payment-methods.html.twig` +- [x] `myaccount/form-add-payment-method.html.twig` +- [x] `myaccount/form-login.html.twig` +- [x] `myaccount/form-lost-password.html.twig` +- [x] `myaccount/form-reset-password.html.twig` +- [x] `myaccount/lost-password-confirmation.html.twig` ### Phase 7 -- Order Details -- [ ] `order/order-details.html.twig` -- [ ] `order/order-details-item.html.twig` -- [ ] `order/order-details-customer.html.twig` -- [ ] `order/form-tracking.html.twig` -- [ ] `order/order-again.html.twig` +- [x] `order/order-details.html.twig` +- [x] `order/order-details-item.html.twig` +- [x] `order/order-details-customer.html.twig` +- [x] `order/form-tracking.html.twig` +- [x] `order/order-again.html.twig` ### Phase 8 -- Emails diff --git a/assets/css/wc-bootstrap.css b/assets/css/wc-bootstrap.css index b5fd3d4..0ec7c2b 100644 --- a/assets/css/wc-bootstrap.css +++ b/assets/css/wc-bootstrap.css @@ -276,3 +276,72 @@ header.sticky-top.is-stuck { .wp-block-navigation__container { overflow: visible !important; } + +/* ========================================================================== + My Account + Navigation and layout for the My Account area. + ========================================================================== */ + +.woocommerce-MyAccount-navigation .list-group-item.active { + font-weight: 600; +} + +/* Order status marks */ +.woocommerce-order-details mark { + background: none; + font-weight: 600; +} + +/* View-order notes */ +.woocommerce-OrderUpdate-description p:last-child { + margin-bottom: 0; +} + +/* Address cards */ +.woocommerce-Address address { + font-style: normal; + line-height: 1.6; +} + +/* My Account forms — apply Bootstrap form-control styles */ +.woocommerce-MyAccount-content .form-row input.input-text, +.woocommerce-MyAccount-content .form-row textarea, +.woocommerce-MyAccount-content .form-row select { + display: block; + width: 100%; + padding: 0.375rem 0.75rem; + font-size: 1rem; + font-weight: 400; + line-height: 1.5; + color: var(--bs-body-color); + background-color: var(--bs-body-bg); + border: var(--bs-border-width) solid var(--bs-border-color); + border-radius: var(--bs-border-radius); + transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; +} + +.woocommerce-MyAccount-content .form-row input.input-text:focus, +.woocommerce-MyAccount-content .form-row textarea:focus, +.woocommerce-MyAccount-content .form-row select:focus { + border-color: #86b7fe; + outline: 0; + box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25); +} + +/* ========================================================================== + Order Details + Styling for the order details and tracking pages. + ========================================================================== */ + +.woocommerce-order-details .table tfoot th { + font-weight: 500; +} + +.woocommerce-order-details .table tfoot tr:last-child th, +.woocommerce-order-details .table tfoot tr:last-child td { + font-weight: 700; +} + +.product-quantity { + white-space: nowrap; +} diff --git a/templates/myaccount/dashboard.html.twig b/templates/myaccount/dashboard.html.twig new file mode 100644 index 0000000..5740c97 --- /dev/null +++ b/templates/myaccount/dashboard.html.twig @@ -0,0 +1,40 @@ +{# + # My Account Dashboard (Bootstrap 5 Override) + # + # Shows the welcome screen on the account dashboard. + # + # Expected context: + # current_user - WP_User object + # + # WooCommerce PHP equivalent: myaccount/dashboard.php + # + # @package WcBootstrap + # @since 0.1.0 + #} + +

+ {{ __('Hello %1$s (not %1$s? Log out)')|format( + '' ~ current_user.display_name|esc_html ~ '', + wc_logout_url()|esc_url + )|wp_kses_post }} +

+ +

+ {% if wc_shipping_enabled() %} + {{ __('From your account dashboard you can view your recent orders, manage your shipping and billing addresses, and edit your password and account details.')|format( + wc_get_endpoint_url('orders')|esc_url, + wc_get_endpoint_url('edit-address')|esc_url, + wc_get_endpoint_url('edit-account')|esc_url + )|wp_kses_post }} + {% else %} + {{ __('From your account dashboard you can view your recent orders, manage your billing address, and edit your password and account details.')|format( + wc_get_endpoint_url('orders')|esc_url, + wc_get_endpoint_url('edit-address')|esc_url, + wc_get_endpoint_url('edit-account')|esc_url + )|wp_kses_post }} + {% endif %} +

+ +{{ do_action('woocommerce_account_dashboard') }} +{{ do_action('woocommerce_before_my_account') }} +{{ do_action('woocommerce_after_my_account') }} diff --git a/templates/myaccount/downloads.html.twig b/templates/myaccount/downloads.html.twig new file mode 100644 index 0000000..730aaf4 --- /dev/null +++ b/templates/myaccount/downloads.html.twig @@ -0,0 +1,31 @@ +{# + # My Account Downloads (Bootstrap 5 Override) + # + # Shows downloads on the account page. + # + # WooCommerce PHP equivalent: myaccount/downloads.php + # + # @package WcBootstrap + # @since 0.1.0 + #} + +{% set downloads = fn('WC').customer.get_downloadable_products() %} +{% set has_downloads = downloads is not empty %} + +{{ do_action('woocommerce_before_account_downloads', has_downloads) }} + +{% if has_downloads %} + {{ do_action('woocommerce_before_available_downloads') }} + {{ do_action('woocommerce_available_downloads', downloads) }} + {{ do_action('woocommerce_after_available_downloads') }} +{% else %} + +{% endif %} + +{{ do_action('woocommerce_after_account_downloads', has_downloads) }} diff --git a/templates/myaccount/form-add-payment-method.html.twig b/templates/myaccount/form-add-payment-method.html.twig new file mode 100644 index 0000000..967dcbe --- /dev/null +++ b/templates/myaccount/form-add-payment-method.html.twig @@ -0,0 +1,66 @@ +{# + # Add Payment Method Form (Bootstrap 5 Override) + # + # Form to add a new payment method to the account. + # + # WooCommerce PHP equivalent: myaccount/form-add-payment-method.php + # + # @package WcBootstrap + # @since 0.1.0 + #} + +{% set available_gateways = fn('WC').payment_gateways.get_available_payment_gateways() %} + +{% if available_gateways is not empty %} +
+
+ + + {{ do_action('woocommerce_add_payment_method_form_bottom') }} + +
+ {{ wp_nonce_field('woocommerce-add-payment-method', 'woocommerce-add-payment-method-nonce') }} + + +
+
+
+{% else %} + +{% endif %} diff --git a/templates/myaccount/form-edit-account.html.twig b/templates/myaccount/form-edit-account.html.twig new file mode 100644 index 0000000..200acec --- /dev/null +++ b/templates/myaccount/form-edit-account.html.twig @@ -0,0 +1,138 @@ +{# + # Edit Account Form (Bootstrap 5 Override) + # + # Account details editing form with Bootstrap form styling. + # + # Expected context: + # user - WP_User object + # + # WooCommerce PHP equivalent: myaccount/form-edit-account.php + # + # @package WcBootstrap + # @since 0.1.0 + #} + +{{ do_action('woocommerce_before_edit_account_form') }} + +
+ + {{ do_action('woocommerce_edit_account_form_start') }} + +
+
+ + +
+
+ + +
+
+ +
+ + +
+ {{ __('This will be how your name will be displayed in the account section and in reviews') }} +
+
+ +
+ + +
+ + {{ do_action('woocommerce_edit_account_form_fields') }} + +
+ {{ __('Password change') }} + +
+ + +
+ +
+ + +
+ +
+ + +
+
+ + {{ do_action('woocommerce_edit_account_form') }} + +
+ {{ wp_nonce_field('save_account_details', 'save-account-details-nonce') }} + + +
+ + {{ do_action('woocommerce_edit_account_form_end') }} +
+ +{{ do_action('woocommerce_after_edit_account_form') }} diff --git a/templates/myaccount/form-edit-address.html.twig b/templates/myaccount/form-edit-address.html.twig new file mode 100644 index 0000000..597254d --- /dev/null +++ b/templates/myaccount/form-edit-address.html.twig @@ -0,0 +1,49 @@ +{# + # Edit Address Form (Bootstrap 5 Override) + # + # Address editing form with Bootstrap form styling. + # + # Expected context: + # load_address - Address type ('billing' or 'shipping'), or empty + # address - Array of address fields + # + # WooCommerce PHP equivalent: myaccount/form-edit-address.php + # + # @package WcBootstrap + # @since 0.1.0 + #} + +{% set page_title = load_address == 'billing' ? __('Billing address') : __('Shipping address') %} + +{{ do_action('woocommerce_before_edit_account_address_form') }} + +{% if not load_address %} + {% include 'myaccount/my-address.html.twig' %} +{% else %} +
+

{{ apply_filters('woocommerce_my_account_edit_address_title', page_title, load_address) }}

+ +
+ {{ do_action('woocommerce_before_edit_address_form_' ~ load_address) }} + +
+ {% for key, field in address %} + {{ woocommerce_form_field(key, field, wc_get_post_data_by_key(key, field.value)) }} + {% endfor %} +
+ + {{ do_action('woocommerce_after_edit_address_form_' ~ load_address) }} + +
+ + {{ wp_nonce_field('woocommerce-edit_address', 'woocommerce-edit-address-nonce') }} + +
+
+
+{% endif %} + +{{ do_action('woocommerce_after_edit_account_address_form') }} diff --git a/templates/myaccount/form-login.html.twig b/templates/myaccount/form-login.html.twig new file mode 100644 index 0000000..403f63d --- /dev/null +++ b/templates/myaccount/form-login.html.twig @@ -0,0 +1,169 @@ +{# + # My Account Login / Register Form (Bootstrap 5 Override) + # + # Login and optional registration form for the My Account page. + # This is distinct from global/form-login.html.twig (inline checkout login). + # + # WooCommerce PHP equivalent: myaccount/form-login.php + # + # @package WcBootstrap + # @since 0.1.0 + #} + +{{ do_action('woocommerce_before_customer_login_form') }} + +{% set registration_enabled = get_option('woocommerce_enable_myaccount_registration') == 'yes' %} + +
+
+
+
+

{{ __('Login') }}

+
+
+ +
+
+
+ + {% if registration_enabled %} +
+
+
+

{{ __('Register') }}

+
+
+
+ + {{ do_action('woocommerce_register_form_start') }} + + {% if get_option('woocommerce_registration_generate_username') == 'no' %} +
+ + +
+ {% endif %} + +
+ + +
+ + {% if get_option('woocommerce_registration_generate_password') == 'no' %} +
+ + +
+ {% else %} +

{{ __('A link to set a new password will be sent to your email address.') }}

+ {% endif %} + + {{ do_action('woocommerce_register_form') }} + +
+ {{ wp_nonce_field('woocommerce-register', 'woocommerce-register-nonce') }} + +
+ + {{ do_action('woocommerce_register_form_end') }} +
+
+
+
+ {% endif %} +
+ +{{ do_action('woocommerce_after_customer_login_form') }} diff --git a/templates/myaccount/form-lost-password.html.twig b/templates/myaccount/form-lost-password.html.twig new file mode 100644 index 0000000..cbcf70a --- /dev/null +++ b/templates/myaccount/form-lost-password.html.twig @@ -0,0 +1,47 @@ +{# + # Lost Password Form (Bootstrap 5 Override) + # + # Form to request a password reset email. + # + # WooCommerce PHP equivalent: myaccount/form-lost-password.php + # + # @package WcBootstrap + # @since 0.1.0 + #} + +{{ do_action('woocommerce_before_lost_password_form') }} + +
+ +

+ {{ apply_filters('woocommerce_lost_password_message', __('Lost your password? Please enter your username or email address. You will receive a link to create a new password via email.')) }} +

+ +
+ + +
+ + {{ do_action('woocommerce_lostpassword_form') }} + +
+ + +
+ + {{ wp_nonce_field('lost_password', 'woocommerce-lost-password-nonce') }} + +
+ +{{ do_action('woocommerce_after_lost_password_form') }} diff --git a/templates/myaccount/form-reset-password.html.twig b/templates/myaccount/form-reset-password.html.twig new file mode 100644 index 0000000..ffa17ba --- /dev/null +++ b/templates/myaccount/form-reset-password.html.twig @@ -0,0 +1,68 @@ +{# + # Reset Password Form (Bootstrap 5 Override) + # + # Form to set a new password after clicking the reset link. + # + # Expected context: + # args - Array with 'key' and 'login' values + # + # WooCommerce PHP equivalent: myaccount/form-reset-password.php + # + # @package WcBootstrap + # @since 0.1.0 + #} + +{{ do_action('woocommerce_before_reset_password_form') }} + +
+ +

+ {{ apply_filters('woocommerce_reset_password_message', __('Enter a new password below.')) }} +

+ +
+
+ + +
+
+ + +
+
+ + + + + {{ do_action('woocommerce_resetpassword_form') }} + +
+ + +
+ + {{ wp_nonce_field('reset_password', 'woocommerce-reset-password-nonce') }} + +
+ +{{ do_action('woocommerce_after_reset_password_form') }} diff --git a/templates/myaccount/lost-password-confirmation.html.twig b/templates/myaccount/lost-password-confirmation.html.twig new file mode 100644 index 0000000..d7beba7 --- /dev/null +++ b/templates/myaccount/lost-password-confirmation.html.twig @@ -0,0 +1,23 @@ +{# + # Lost Password Confirmation (Bootstrap 5 Override) + # + # Confirmation text after password reset email has been sent. + # + # WooCommerce PHP equivalent: myaccount/lost-password-confirmation.php + # + # @package WcBootstrap + # @since 0.1.0 + #} + + + +{{ do_action('woocommerce_before_lost_password_confirmation_message') }} + +

+ {{ apply_filters('woocommerce_lost_password_confirmation_message', __('A password reset email has been sent to the email address on file for your account, but may take several minutes to show up in your inbox. Please wait at least 10 minutes before attempting another reset.')) }} +

+ +{{ do_action('woocommerce_after_lost_password_confirmation_message') }} diff --git a/templates/myaccount/my-account.html.twig b/templates/myaccount/my-account.html.twig new file mode 100644 index 0000000..d081944 --- /dev/null +++ b/templates/myaccount/my-account.html.twig @@ -0,0 +1,27 @@ +{# + # My Account Page (Bootstrap 5 Override) + # + # Main wrapper for the My Account area. Renders sidebar navigation + # and the current endpoint content. + # + # WooCommerce PHP equivalent: myaccount/my-account.php + # + # @package WcBootstrap + # @since 0.1.0 + #} + +{{ do_action('woocommerce_before_my_account') }} + +
+
+ {% include 'myaccount/navigation.html.twig' %} +
+ +
+
+ {{ do_action('woocommerce_account_content') }} +
+
+
+ +{{ do_action('woocommerce_after_my_account') }} diff --git a/templates/myaccount/my-address.html.twig b/templates/myaccount/my-address.html.twig new file mode 100644 index 0000000..c2f9cb4 --- /dev/null +++ b/templates/myaccount/my-address.html.twig @@ -0,0 +1,57 @@ +{# + # My Addresses (Bootstrap 5 Override) + # + # Shows billing and shipping addresses as Bootstrap cards. + # + # WooCommerce PHP equivalent: myaccount/my-address.php + # + # @package WcBootstrap + # @since 0.1.0 + #} + +{% set customer_id = get_current_user_id() %} + +{% if not wc_ship_to_billing_address_only() and wc_shipping_enabled() %} + {% set get_addresses = apply_filters('woocommerce_my_account_get_addresses', { + billing: __('Billing address'), + shipping: __('Shipping address') + }, customer_id) %} +{% else %} + {% set get_addresses = apply_filters('woocommerce_my_account_get_addresses', { + billing: __('Billing address') + }, customer_id) %} +{% endif %} + +

+ {{ apply_filters('woocommerce_my_account_my_address_description', __('The following addresses will be used on the checkout page by default.')) }} +

+ +
+ {% for name, address_title in get_addresses %} + {% set address = wc_get_account_formatted_address(name) %} +
+
+ +
+
+ {% if address %} + {{ address|wp_kses_post }} + {% else %} + {{ __('You have not set up this type of address yet.') }} + {% endif %} +
+ {{ do_action('woocommerce_my_account_after_my_address', name) }} +
+
+
+ {% endfor %} +
diff --git a/templates/myaccount/navigation.html.twig b/templates/myaccount/navigation.html.twig new file mode 100644 index 0000000..ee2be81 --- /dev/null +++ b/templates/myaccount/navigation.html.twig @@ -0,0 +1,23 @@ +{# + # My Account Navigation (Bootstrap 5 Override) + # + # Renders the sidebar navigation for the My Account area + # using Bootstrap list-group component. + # + # WooCommerce PHP equivalent: myaccount/navigation.php + # + # @package WcBootstrap + # @since 0.1.0 + #} + + diff --git a/templates/myaccount/orders.html.twig b/templates/myaccount/orders.html.twig new file mode 100644 index 0000000..1dcad9d --- /dev/null +++ b/templates/myaccount/orders.html.twig @@ -0,0 +1,126 @@ +{# + # My Account Orders (Bootstrap 5 Override) + # + # Shows orders table on the account page with Bootstrap table styling. + # HPOS compatible: uses WC_Order methods only. + # + # Expected context: + # has_orders - boolean + # customer_orders - object with .orders array and .max_num_pages + # current_page - current pagination page number + # wp_button_class - WP theme button class + # + # WooCommerce PHP equivalent: myaccount/orders.php + # + # @package WcBootstrap + # @since 0.1.0 + #} + +{{ do_action('woocommerce_before_account_orders', has_orders) }} + +{% if has_orders %} +
+ + + + {% for column_id, column_name in wc_get_account_orders_columns() %} + + {% endfor %} + + + + {% for customer_order in customer_orders.orders %} + {% set order = wc_get_order(customer_order) %} + {% set item_count = order.get_item_count() - order.get_item_count_refunded() %} + + {% for column_id, column_name in wc_get_account_orders_columns() %} + {% if column_id == 'order-number' %} + + {% elseif column_id == 'order-date' %} + + {% elseif column_id == 'order-status' %} + + {% elseif column_id == 'order-total' %} + + {% elseif column_id == 'order-actions' %} + + {% else %} + + {% endif %} + {% endfor %} + + {% endfor %} + +
{{ column_name|esc_html }}
+ + #{{ order.get_order_number()|esc_html }} + + + + + {% set status = order.get_status() %} + {% if status == 'completed' %} + {{ wc_get_order_status_name(status)|esc_html }} + {% elseif status == 'processing' %} + {{ wc_get_order_status_name(status)|esc_html }} + {% elseif status == 'on-hold' %} + {{ wc_get_order_status_name(status)|esc_html }} + {% elseif status == 'cancelled' or status == 'failed' or status == 'refunded' %} + {{ wc_get_order_status_name(status)|esc_html }} + {% else %} + {{ wc_get_order_status_name(status)|esc_html }} + {% endif %} + + {{ _n('%1$s for %2$s item', '%1$s for %2$s items', item_count)|format(order.get_formatted_order_total(), item_count)|wp_kses_post }} + + {% set actions = wc_get_account_orders_actions(order) %} + {% if actions is not empty %} +
+ {% for key, action in actions %} + + {{ action.name|esc_html }} + + {% endfor %} +
+ {% endif %} +
+ {{ do_action('woocommerce_my_account_my_orders_column_' ~ column_id, order) }} +
+
+ + {{ do_action('woocommerce_before_account_orders_pagination') }} + + {% if customer_orders.max_num_pages > 1 %} + + {% endif %} +{% else %} + +{% endif %} + +{{ do_action('woocommerce_after_account_orders', has_orders) }} diff --git a/templates/myaccount/payment-methods.html.twig b/templates/myaccount/payment-methods.html.twig new file mode 100644 index 0000000..746a9b3 --- /dev/null +++ b/templates/myaccount/payment-methods.html.twig @@ -0,0 +1,78 @@ +{# + # Payment Methods (Bootstrap 5 Override) + # + # Shows saved payment methods on the account page. + # + # WooCommerce PHP equivalent: myaccount/payment-methods.php + # + # @package WcBootstrap + # @since 0.1.0 + #} + +{% set saved_methods = wc_get_customer_saved_methods_list(get_current_user_id()) %} +{% set has_methods = saved_methods is not empty %} + +{{ do_action('woocommerce_before_account_payment_methods', has_methods) }} + +{% if has_methods %} +
+ + + + {% for column_id, column_name in wc_get_account_payment_methods_columns() %} + + {% endfor %} + + + + {% for type, methods in saved_methods %} + {% for method in methods %} + + {% for column_id, column_name in wc_get_account_payment_methods_columns() %} + + {% endfor %} + + {% endfor %} + {% endfor %} + +
{{ column_name|esc_html }}
+ {% if column_id == 'method' %} + {% if method.method.last4 is defined and method.method.last4 %} + {{ __('%1$s ending in %2$s')|format(wc_get_credit_card_type_label(method.method.brand)|esc_html, method.method.last4|esc_html) }} + {% else %} + {{ wc_get_credit_card_type_label(method.method.brand)|esc_html }} + {% endif %} + {% if method.is_default|default(false) %} + {{ __('Default') }} + {% endif %} + {% elseif column_id == 'expires' %} + {{ method.expires|esc_html }} + {% elseif column_id == 'actions' %} +
+ {% for key, action in method.actions %} + + {{ action.name|esc_html }} + + {% endfor %} +
+ {% else %} + {{ do_action('woocommerce_account_payment_methods_column_' ~ column_id, method) }} + {% endif %} +
+
+{% else %} + +{% endif %} + +{{ do_action('woocommerce_after_account_payment_methods', has_methods) }} + +{% if fn('WC').payment_gateways.get_available_payment_gateways() is not empty %} + + + {{ __('Add payment method') }} + +{% endif %} diff --git a/templates/myaccount/view-order.html.twig b/templates/myaccount/view-order.html.twig new file mode 100644 index 0000000..1390198 --- /dev/null +++ b/templates/myaccount/view-order.html.twig @@ -0,0 +1,45 @@ +{# + # View Order (Bootstrap 5 Override) + # + # Shows details of a specific order on the account page. + # HPOS compatible: uses WC_Order methods only. + # + # Expected context: + # order_id - Order ID + # order - WC_Order object + # + # WooCommerce PHP equivalent: myaccount/view-order.php + # + # @package WcBootstrap + # @since 0.1.0 + #} + +{% set notes = order.get_customer_order_notes() %} + +

+ {{ __('Order #%1$s was placed on %2$s and is currently %3$s.')|format( + '' ~ order.get_order_number() ~ '', + '' ~ wc_format_datetime(order.get_date_created()) ~ '', + '' ~ wc_get_order_status_name(order.get_status()) ~ '' + )|wp_kses_post }} +

+ +{% if notes %} +

{{ __('Order updates') }}

+
+ {% for note in notes %} +
+
+ + {{ date_i18n(__('l jS \\o\\f F Y, h:ia'), strtotime(note.comment_date)) }} + +
+
+ {{ wpautop(wptexturize(note.comment_content))|raw }} +
+
+ {% endfor %} +
+{% endif %} + +{{ do_action('woocommerce_view_order', order_id) }} diff --git a/templates/order/form-tracking.html.twig b/templates/order/form-tracking.html.twig new file mode 100644 index 0000000..9504d8b --- /dev/null +++ b/templates/order/form-tracking.html.twig @@ -0,0 +1,52 @@ +{# + # Order Tracking Form (Bootstrap 5 Override) + # + # Form to look up an order by ID and billing email. + # + # WooCommerce PHP equivalent: order/form-tracking.php + # + # @package WcBootstrap + # @since 0.1.0 + #} + +
+ + {{ do_action('woocommerce_order_tracking_form_start') }} + +

+ {{ __('To track your order please enter your Order ID in the box below and press the "Track" button. This was given to you on your receipt and in the confirmation email you should have received.') }} +

+ +
+
+ + +
+
+ + +
+
+ + {{ do_action('woocommerce_order_tracking_form') }} + +
+ +
+ + {{ wp_nonce_field('woocommerce-order_tracking', 'woocommerce-order-tracking-nonce') }} + + {{ do_action('woocommerce_order_tracking_form_end') }} + +
diff --git a/templates/order/order-again.html.twig b/templates/order/order-again.html.twig new file mode 100644 index 0000000..900fa46 --- /dev/null +++ b/templates/order/order-again.html.twig @@ -0,0 +1,20 @@ +{# + # Order Again Button (Bootstrap 5 Override) + # + # Renders a button to reorder a previous order. + # + # Expected context: + # order_again_url - URL to reorder + # + # WooCommerce PHP equivalent: order/order-again.php + # + # @package WcBootstrap + # @since 0.1.0 + #} + +

+ + + {{ __('Order again') }} + +

diff --git a/templates/order/order-details-customer.html.twig b/templates/order/order-details-customer.html.twig new file mode 100644 index 0000000..68306d4 --- /dev/null +++ b/templates/order/order-details-customer.html.twig @@ -0,0 +1,75 @@ +{# + # Order Details Customer (Bootstrap 5 Override) + # + # Displays billing and shipping addresses for a completed order. + # HPOS compatible: uses WC_Order methods only. + # + # Expected context: + # order - WC_Order object + # + # WooCommerce PHP equivalent: order/order-details-customer.php + # + # @package WcBootstrap + # @since 0.1.0 + #} + +{% set show_shipping = not wc_ship_to_billing_address_only() and order.needs_shipping_address() %} + +
+
+
+
+
+

{{ __('Billing address') }}

+
+
+
+ {{ order.get_formatted_billing_address(__('N/A'))|wp_kses_post }} + + {% if order.get_billing_phone() %} +

+ + {{ order.get_billing_phone()|esc_html }} +

+ {% endif %} + + {% if order.get_billing_email() %} + + {% endif %} + + {{ do_action('woocommerce_order_details_after_customer_address', 'billing', order) }} +
+
+
+
+ + {% if show_shipping %} +
+
+
+

{{ __('Shipping address') }}

+
+
+
+ {{ order.get_formatted_shipping_address(__('N/A'))|wp_kses_post }} + + {% if order.get_shipping_phone() %} +

+ + {{ order.get_shipping_phone()|esc_html }} +

+ {% endif %} + + {{ do_action('woocommerce_order_details_after_customer_address', 'shipping', order) }} +
+
+
+
+ {% endif %} +
+ + {{ do_action('woocommerce_order_details_after_customer_details', order) }} +
diff --git a/templates/order/order-details-item.html.twig b/templates/order/order-details-item.html.twig new file mode 100644 index 0000000..e37c18b --- /dev/null +++ b/templates/order/order-details-item.html.twig @@ -0,0 +1,63 @@ +{# + # Order Details Item (Bootstrap 5 Override) + # + # Renders a single line item row within the order details table. + # HPOS compatible: uses WC_Order methods only. + # + # Expected context: + # order - WC_Order object + # item_id - Item ID + # item - WC_Order_Item_Product object + # show_purchase_note - Whether to show purchase note + # purchase_note - Purchase note text + # product - WC_Product object or null + # + # WooCommerce PHP equivalent: order/order-details-item.php + # + # @package WcBootstrap + # @since 0.1.0 + #} + +{% if not apply_filters('woocommerce_order_item_visible', true, item) %} + {% do return() %} +{% endif %} + +{% set is_visible = product and product.is_visible() %} +{% set product_permalink = apply_filters('woocommerce_order_item_permalink', is_visible ? product.get_permalink(item) : '', item, order) %} + + + + {% if product_permalink %} + {{ item.get_name()|esc_html }} + {% else %} + {{ item.get_name()|esc_html }} + {% endif %} + + {% set qty = item.get_quantity() %} + {% set refunded_qty = order.get_qty_refunded_for_item(item_id) %} + + + {% if refunded_qty %} + × {{ qty }} {{ qty - (refunded_qty * -1) }} + {% else %} + × {{ qty }} + {% endif %} + + + {{ do_action('woocommerce_order_item_meta_start', item_id, item, order, false) }} + {{ wc_display_item_meta(item) }} + {{ do_action('woocommerce_order_item_meta_end', item_id, item, order, false) }} + + + + {{ order.get_formatted_line_subtotal(item)|raw }} + + + +{% if show_purchase_note and purchase_note %} + + + {{ purchase_note|wp_kses_post|wpautop }} + + +{% endif %} diff --git a/templates/order/order-details.html.twig b/templates/order/order-details.html.twig new file mode 100644 index 0000000..235fcd5 --- /dev/null +++ b/templates/order/order-details.html.twig @@ -0,0 +1,91 @@ +{# + # Order Details (Bootstrap 5 Override) + # + # Renders the full order details table with items, totals, and customer info. + # HPOS compatible: uses WC_Order methods only. + # + # Expected context: + # order_id - Order ID + # show_downloads - Whether to show downloads table + # + # WooCommerce PHP equivalent: order/order-details.php + # + # @package WcBootstrap + # @since 0.1.0 + #} + +{% set order = wc_get_order(order_id) %} + +{% if not order %} + {% do return() %} +{% endif %} + +{% set order_items = order.get_items(apply_filters('woocommerce_purchase_order_item_types', 'line_item')) %} +{% set show_purchase_note = order.has_status(apply_filters('woocommerce_purchase_note_order_statuses', ['completed', 'processing'])) %} +{% set show_customer_details = order.get_user_id() == get_current_user_id() %} + +{% if show_downloads is defined and show_downloads %} + {% set downloads = order.get_downloadable_items() %} + {% if downloads is not empty %} + {{ wc_get_template('order/order-downloads.php', { downloads: downloads, show_title: true }) }} + {% endif %} +{% endif %} + +
+ {{ do_action('woocommerce_order_details_before_order_table', order) }} + +

{{ __('Order details') }}

+ +
+ + + + + + + + + + {{ do_action('woocommerce_order_details_before_order_table_items', order) }} + + {% for item_id, item in order_items %} + {% set product = item.get_product() %} + {% include 'order/order-details-item.html.twig' with { + order: order, + item_id: item_id, + item: item, + show_purchase_note: show_purchase_note, + purchase_note: product ? product.get_purchase_note() : '', + product: product + } %} + {% endfor %} + + {{ do_action('woocommerce_order_details_after_order_table_items', order) }} + + + + {% for key, total in order.get_order_item_totals() %} + + + + + {% endfor %} + + {% if order.get_customer_note() %} + + + + + {% endif %} + +
{{ __('Product') }}{{ __('Total') }}
{{ total.label|esc_html }}{{ total.value|wp_kses_post }}
{{ __('Note:') }}{{ order.get_customer_note()|nl2br|esc_html }}
+
+ + {{ do_action('woocommerce_order_details_after_order_table', order) }} +
+ +{{ do_action('woocommerce_after_order_details', order) }} + +{% if show_customer_details %} + {% include 'order/order-details-customer.html.twig' with { order: order } %} +{% endif %}