Rework confusing shipping message on cart page when calculator is disabled and no methods are available. (#24807)

* Check if shipping calculator is enabled before showing related message in cart totals.

Fixes #24674

* Check if on cart then is shipping calculator is enabled before showing related message. Fixes #24674

* Update no shipping available on cart message

Fix #24674
This commit is contained in:
Dhaval Shah 2019-10-27 23:06:41 +05:30 committed by Claudio Sanches
parent cb21ea7a3d
commit 0fb01e6886
1 changed files with 5 additions and 1 deletions

View File

@ -58,7 +58,11 @@ $calculator_text = '';
<?php endif; ?>
<?php
elseif ( ! $has_calculated_shipping || ! $formatted_destination ) :
echo wp_kses_post( apply_filters( 'woocommerce_shipping_may_be_available_html', __( 'Enter your address to view shipping options.', 'woocommerce' ) ) );
if ( is_cart() && 'no' === get_option( 'woocommerce_enable_shipping_calc' ) ) {
echo wp_kses_post( apply_filters( 'woocommerce_shipping_may_be_available_cart_nocalc_html', __( 'Shipping costs are calculated during checkout.', 'woocommerce' ) ) );
} else {
echo wp_kses_post( apply_filters( 'woocommerce_shipping_may_be_available_html', __( 'Enter your address to view shipping options.', 'woocommerce' ) ) );
}
elseif ( ! is_cart() ) :
echo wp_kses_post( apply_filters( 'woocommerce_no_shipping_available_html', __( 'There are no shipping options available. Please ensure that your address has been entered correctly, or contact us if you need any help.', 'woocommerce' ) ) );
else :