From 22a928777ca6d2d8ca18cdb028abec10b7a331bd Mon Sep 17 00:00:00 2001 From: Bart Jaskulski <bjaskulski@protonmail.com> Date: Tue, 21 Feb 2023 14:20:34 +0100 Subject: [PATCH] feat: update template to latest woocommerce version This template update is required to suppress any messages about outdated woocommerce templates visible as admin notice. Such notice may push our website elements lower causing errors in acceptance tests, which relies on UI elements. Signed-off-by: Bart Jaskulski <bjaskulski@protonmail.com> --- woocommerce/cart/cart-shipping.php | 32 +++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/woocommerce/cart/cart-shipping.php b/woocommerce/cart/cart-shipping.php index 8470f8f..2b0fa13 100644 --- a/woocommerce/cart/cart-shipping.php +++ b/woocommerce/cart/cart-shipping.php @@ -13,8 +13,8 @@ * the readme will list any important changes. * * @see https://docs.woocommerce.com/document/template-structure/ - * @package WooCommerce/Templates - * @version 3.6.0 + * @package WooCommerce\Templates + * @version 7.3.0 */ defined( 'ABSPATH' ) || exit; @@ -49,7 +49,7 @@ $calculator_text = ''; if ( $formatted_destination ) { // Translators: $s shipping destination. printf( esc_html__( 'Shipping to %s.', 'woocommerce' ) . ' ', '<strong>' . esc_html( $formatted_destination ) . '</strong>' ); - $calculator_text = __( 'Change address', 'woocommerce' ); + $calculator_text = esc_html__( 'Change address', 'woocommerce' ); } else { echo wp_kses_post( apply_filters( 'woocommerce_shipping_estimate_html', __( 'Shipping options will be updated during checkout.', 'woocommerce' ) ) ); } @@ -58,13 +58,31 @@ $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_not_enabled_on_cart_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 : - // Translators: $s shipping destination. - echo wp_kses_post( apply_filters( 'woocommerce_cart_no_shipping_available_html', sprintf( esc_html__( 'No shipping options were found for %s.', 'woocommerce' ) . ' ', '<strong>' . esc_html( $formatted_destination ) . '</strong>' ) ) ); - $calculator_text = __( 'Enter a different address', 'woocommerce' ); + echo wp_kses_post( + /** + * Provides a means of overriding the default 'no shipping available' HTML string. + * + * @since 3.0.0 + * + * @param string $html HTML message. + * @param string $formatted_destination The formatted shipping destination. + */ + apply_filters( + 'woocommerce_cart_no_shipping_available_html', + // Translators: $s shipping destination. + sprintf( esc_html__( 'No shipping options were found for %s.', 'woocommerce' ) . ' ', '<strong>' . esc_html( $formatted_destination ) . '</strong>' ), + $formatted_destination + ) + ); + $calculator_text = esc_html__( 'Enter a different address', 'woocommerce' ); endif; ?> -- GitLab