Conditionally change my account dashboard desc

Conditionally change my account dashboard description to reflect whether or not shipping has been disabled in WooCommerce > Settings > General > General options.

Signed-off-by: Leon Francis Shelhamer <leon@211j.com>
This commit is contained in:
Leon Francis Shelhamer 2020-04-28 21:37:55 -04:00
parent 15f8eb04c4
commit 3a585c4e23
2 changed files with 11 additions and 2 deletions

View File

@ -95,11 +95,16 @@ function wc_get_account_menu_items() {
'customer-logout' => get_option( 'woocommerce_logout_endpoint', 'customer-logout' ),
);
$edit_address = __( 'Address', 'woocommerce' );
if ( get_option( 'woocommerce_ship_to_countries' ) !== 'disabled' ) {
$edit_address = __( 'Addresses', 'woocommerce' );
}
$items = array(
'dashboard' => __( 'Dashboard', 'woocommerce' ),
'orders' => __( 'Orders', 'woocommerce' ),
'downloads' => __( 'Downloads', 'woocommerce' ),
'edit-address' => __( 'Addresses', 'woocommerce' ),
'edit-address' => $edit_address,
'payment-methods' => __( 'Payment methods', 'woocommerce' ),
'edit-account' => __( 'Account details', 'woocommerce' ),
'customer-logout' => __( 'Logout', 'woocommerce' ),

View File

@ -35,8 +35,12 @@ if ( ! defined( 'ABSPATH' ) ) {
<p>
<?php
$dashboard_desc = __( 'From your account dashboard you can view your <a href="%1$s">recent orders</a>, manage your <a href="%2$s">billing address</a>, and <a href="%3$s">edit your password and account details</a>.', 'woocommerce' );
if ( get_option( 'woocommerce_ship_to_countries' ) !== 'disabled' ) {
$dashboard_desc = __( 'From your account dashboard you can view your <a href="%1$s">recent orders</a>, manage your <a href="%2$s">shipping and billing addresses</a>, and <a href="%3$s">edit your password and account details</a>.', 'woocommerce' );
}
printf(
__( 'From your account dashboard you can view your <a href="%1$s">recent orders</a>, manage your <a href="%2$s">shipping and billing addresses</a>, and <a href="%3$s">edit your password and account details</a>.', 'woocommerce' ),
$dashboard_desc,
esc_url( wc_get_endpoint_url( 'orders' ) ),
esc_url( wc_get_endpoint_url( 'edit-address' ) ),
esc_url( wc_get_endpoint_url( 'edit-account' ) )