WooCommerce Cart – No error message is displayed outside the shipping area

This topic has 14 replies, 3 voices, and was last updated 4 months, 1 weeks ago ago by Andrew Mitchell

  • Avatar: ProdbyDaan
    ProdbyDaan
    Participant
    February 21, 2024 at 11:16

    Hey Team,

    if a customer writes his Postcode into the Shipping Area field in the cart area, he doesn’t get a message the postcode is outside our shipping area.

    Not in the shipping area:
    https://i.imgur.com/3J1IU7J.png

    If a customer is in the shipping area:
    https://i.imgur.com/X9POYQF.png

    Do you know how to fix it?

    Best regards,
    Daniel

    13 Answers
    Avatar: ProdbyDaan
    ProdbyDaan
    Participant
    February 21, 2024 at 11:25

    I saw this https://i.imgur.com/3kL1lZH.png
    But after Apply it says it’s done. After clearing the cache its back again.

    I cleared the WP Cache, Redis Cache, CDN Cache.
    But its already back.

    Avatar: ProdbyDaan
    ProdbyDaan
    Participant
    February 21, 2024 at 11:42

    Ive created Admin Login for you

    Please contact administrator
    for this information.
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    February 21, 2024 at 13:21

    Hello, ProdbyDaan,

    Thank you for contacting us and for using XStore.

    1/ We would like to kindly ask you to perform a diagnostic check by activating a default WordPress theme, such as Storefront, which can be found under Appearance > Themes in your dashboard. This step will help us determine if the issue you are encountering is related to our theme. Please inform us of the outcome once you have completed this action.

    2/ Upon review, we have confirmed that the patch was applied successfully. Therefore, you may disregard it for the time being.

    Kind Regards,
    8theme team

    Avatar: ProdbyDaan
    ProdbyDaan
    Participant
    February 21, 2024 at 13:36

    Hey Rose, thank you for the quick response.

    It installed the Storefront in the Staging Environment, but the issue is still there.

    You can see it under my staging site.
    Login is provided here.

    Please contact administrator
    for this information.
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    February 21, 2024 at 14:39

    Hello, ProdbyDaan,

    We are grateful for your swift reply.

    The test you have conducted has demonstrated that the issue you are encountering is not related to the theme currently activated on your website. As the support team for the theme, we advise you to reach out to the WooCommerce support service for further assistance. The functionality in question is provided by WooCommerce, and with the results of the test you have performed, you will likely receive more expedited help from their team.

    For your convenience, here is the link to the WooCommerce support forum: https://wordpress.org/support/plugin/woocommerce/

    Kind Regards,
    8theme team

    Avatar: ProdbyDaan
    ProdbyDaan
    Participant
    February 25, 2024 at 21:19

    Hey Rose, I think it has to do with your theme.

    I had a not patched Version Website of the WooCommerce fix.
    With an “old” shipping-cart.php file.

    Here is the File:

    <?php
    /**
     * Shipping Methods Display
     *
     * In 2.1 we show methods per package. This allows for multiple methods per order if so desired.
     *
     * This template can be overridden by copying it to yourtheme/woocommerce/cart/cart-shipping.php.
     *
     * HOWEVER, on occasion WooCommerce will need to update template files and you
     * (the theme developer) will need to copy the new files to your theme to
     * maintain compatibility. We try to do this as little as possible, but it does
     * happen. When this occurs the version of the template file will be bumped and
     * the readme will list any important changes.
     *
     * @see https://docs.woocommerce.com/document/template-structure/
     * @package WooCommerce/Templates
     * @version 7.3.0
     */
    
    defined( 'ABSPATH' ) || exit;
    
    $formatted_destination    = isset( $formatted_destination ) ? $formatted_destination : WC()->countries->get_formatted_address( $package['destination'], ', ' );
    $has_calculated_shipping  = ! empty( $has_calculated_shipping );
    $show_shipping_calculator = ! empty( $show_shipping_calculator );
    $calculator_text          = '';
    $shipping_total_heading = apply_filters('etheme_cart_shipping_heading', true);
    $shipping_total_stretch = apply_filters('etheme_cart_shipping_full_width', false);
    if ( $shipping_total_stretch && $shipping_total_heading ) : ?>
    <tr class="woocommerce-shipping-totals shipping">
        <th colspan="2">
    		<?php echo wp_kses_post( $package_name ); ?>
        </th>
    </tr>
    <?php endif; ?>
    <tr class="woocommerce-shipping-totals shipping">
        <?php if ( !$shipping_total_stretch && $shipping_total_heading ) : ?>
            <th>
                <?php echo wp_kses_post( $package_name ); ?>
            </th>
        <?php endif; ?>
        <td<?php if ($shipping_total_stretch) echo ' colspan="2"'; ?> data-title="<?php echo esc_attr( $package_name ); ?>">
    		<?php if ( $available_methods ) :
                if ( apply_filters('etheme_show_chosen_shipping_method', false) ) {
                    if ( $chosen_method ) {
                        printf( '<label for="shipping_method_%1$s_%2$s">%3$s</label>', $index, esc_attr( sanitize_title( $available_methods[ $chosen_method ]->id ) ), wc_cart_totals_shipping_method_label( $available_methods[ $chosen_method ] ) ); // WPCS: XSS ok.
                    }
                }
                else {
                    ?>
                    <ul id="shipping_method" class="woocommerce-shipping-methods">
                        <?php foreach ( $available_methods as $method ) : ?>
                            <li>
                                <?php
                               
                                    if ( 1 < count( $available_methods ) ) {
                                        printf( '<input type="radio" name="shipping_method[%1$d]" data-index="%1$d" id="shipping_method_%1$d_%2$s" value="%3$s" class="shipping_method" %4$s />', $index, esc_attr( sanitize_title( $method->id ) ), esc_attr( $method->id ), checked( $method->id, $chosen_method, false ) ); // WPCS: XSS ok.
                                    } else {
                                        printf( '<input type="hidden" name="shipping_method[%1$d]" data-index="%1$d" id="shipping_method_%1$d_%2$s" value="%3$s" class="shipping_method" />', $index, esc_attr( sanitize_title( $method->id ) ), esc_attr( $method->id ) ); // WPCS: XSS ok.
                                    }
        //
                                    printf( '<label for="shipping_method_%1$s_%2$s">%3$s</label>', $index, esc_attr( sanitize_title( $method->id ) ), wc_cart_totals_shipping_method_label( $method ) ); // WPCS: XSS ok.
                                 
                                    do_action( 'woocommerce_after_shipping_rate', $method, $index );
                                ?>
                            </li>
                        <?php endforeach; ?>
                    </ul>
    			<?php }
    			if ( is_cart() ) : ?>
                    <p class="woocommerce-shipping-destination">
    					<?php
    					if ( $formatted_destination ) {
    						// Translators: $s shipping destination.
    						printf( esc_html__( 'Shipping to %s.', 'xstore' ) . ' ', '<strong>' . esc_html( $formatted_destination ) . '</strong>' );
    						$calculator_text = esc_html__( 'Change address', 'xstore' );
    					} else {
    						echo wp_kses_post( apply_filters( 'woocommerce_shipping_estimate_html', __( 'Shipping options will be updated during checkout.', 'xstore' ) ) );
    					}
    					?>
                    </p>
    			<?php endif; ?>
    		<?php
            elseif ( ! $has_calculated_shipping || ! $formatted_destination ) :
    			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.', 'xstore' ) ) );
    			} else {
    				echo wp_kses_post( apply_filters( 'woocommerce_shipping_may_be_available_html', __( 'Enter your address to view shipping options.', 'xstore' ) ) );
    			}
            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.', 'xstore' ) ) );
    		else :
                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.', 'xstore' ) . ' ', '<strong>' . esc_html( $formatted_destination ) . '</strong>' ),
                        $formatted_destination
                    )
                );
                $calculator_text = esc_html__( 'Enter a different address', 'xstore' );
    		endif;
    		?>
    
    		<?php if ( $show_package_details ) : ?>
    			<?php echo '<p class="woocommerce-shipping-contents"><small>' . esc_html( $package_details ) . '</small></p>'; ?>
    		<?php endif; ?>
    
    		<?php if ( $show_shipping_calculator ) : ?>
    			<?php woocommerce_shipping_calculator( $calculator_text ); ?>
    		<?php endif; ?>
        </td>
    </tr>

    On the Second, my Live and Staging Page have a different “cart-shipping.php”

    And this is the allegedly fixed Version of the shipping-cart.php file:

    <?php
    /**
     * Shipping Methods Display
     *
     * In 2.1 we show methods per package. This allows for multiple methods per order if so desired.
     *
     * This template can be overridden by copying it to yourtheme/woocommerce/cart/cart-shipping.php.
     *
     * HOWEVER, on occasion WooCommerce will need to update template files and you
     * (the theme developer) will need to copy the new files to your theme to
     * maintain compatibility. We try to do this as little as possible, but it does
     * happen. When this occurs the version of the template file will be bumped and
     * the readme will list any important changes.
     *
     * @see https://woo.com/document/template-structure/
     * @package WooCommerce\Templates
     * @version 8.6.0
     */
    
    defined( 'ABSPATH' ) || exit;
    
    $formatted_destination    = isset( $formatted_destination ) ? $formatted_destination : WC()->countries->get_formatted_address( $package['destination'], ', ' );
    $has_calculated_shipping  = ! empty( $has_calculated_shipping );
    $show_shipping_calculator = ! empty( $show_shipping_calculator );
    $calculator_text          = '';
    ?>
    <tr class="woocommerce-shipping-totals shipping">
    	<th><?php echo wp_kses_post( $package_name ); ?></th>
    	<td data-title="<?php echo esc_attr( $package_name ); ?>">
    		<?php if ( isset( $available_methods ) && is_array( $available_methods ) ) : ?>
    			<ul id="shipping_method" class="woocommerce-shipping-methods">
    				<?php foreach ( $available_methods as $method ) : ?>
    					<li>
    						<?php
    						if ( 1 < count( $available_methods ) ) {
    							printf( '<input type="radio" name="shipping_method[%1$d]" data-index="%1$d" id="shipping_method_%1$d_%2$s" value="%3$s" class="shipping_method" %4$s />', $index, esc_attr( sanitize_title( $method->id ) ), esc_attr( $method->id ), checked( $method->id, $chosen_method, false ) ); // WPCS: XSS ok.
    						} else {
    							printf( '<input type="hidden" name="shipping_method[%1$d]" data-index="%1$d" id="shipping_method_%1$d_%2$s" value="%3$s" class="shipping_method" />', $index, esc_attr( sanitize_title( $method->id ) ), esc_attr( $method->id ) ); // WPCS: XSS ok.
    						}
    						printf( '<label for="shipping_method_%1$s_%2$s">%3$s</label>', $index, esc_attr( sanitize_title( $method->id ) ), wc_cart_totals_shipping_method_label( $method ) ); // WPCS: XSS ok.
    						do_action( 'woocommerce_after_shipping_rate', $method, $index );
    						?>
    					</li>
    				<?php endforeach; ?>
    			</ul>
    			<?php if ( is_cart() ) : ?>
    				<p class="woocommerce-shipping-destination">
    					<?php
    					if ( $formatted_destination ) {
    						// Translators: $s shipping destination.
    						printf( esc_html__( 'Shipping to %s.', 'woocommerce' ) . ' ', '<strong>' . esc_html( $formatted_destination ) . '</strong>' );
    						$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' ) ) );
    					}
    					?>
    				</p>
    			<?php endif; ?>
    			<?php
    		elseif ( ! $has_calculated_shipping || ! $formatted_destination ) :
    			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 :
    			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;
    		?>
    
    		<?php if ( $show_package_details ) : ?>
    			<?php echo '<p class="woocommerce-shipping-contents"><small>' . esc_html( $package_details ) . '</small></p>'; ?>
    		<?php endif; ?>
    
    		<?php if ( $show_shipping_calculator ) : ?>
    			<?php woocommerce_shipping_calculator( $calculator_text ); ?>
    		<?php endif; ?>
    	</td>
    </tr>
    Avatar: ProdbyDaan
    ProdbyDaan
    Participant
    February 25, 2024 at 21:30

    If the fix is installed, it is doesnt matter what theme is active. The Problem is always the same. If import the “old” cart-shipping.php. All works as it should.

    I will upload both files. But how?
    The old version says its WooCommerce/Templates
    @version 7.3.0

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    February 26, 2024 at 07:55

    Hello, ProdbyDaan,

    Please be informed that you can upload files using file-sharing services, such as WeTransfer (https://wetransfer.com/).

    Before we proceed, let us clarify some details to ensure we have a correct understanding of the issue you are experiencing on the website. Are you confirm that the problem you are encountering is not related to the activated theme on the site? In other words, if you switch to the Storefront theme by deactivating XStore, do you experience the same issue? Additionally, are we correct in understanding that you have identified a specific file belonging to the WooCommerce plugin as the cause of the issue? If the answer to both questions is affirmative, it would imply that you should reach out to the WooCommerce plugin support team, as the theme appears does not matter in this context.

    If we have misunderstood your situation, please provide us with further details so we can assist you more effectively.

    Best Regards,
    The 8Theme Team

    Avatar: ProdbyDaan
    ProdbyDaan
    Participant
    February 26, 2024 at 08:22

    Hello Rose,

    here the PHP files https://we.tl/t-uPv5vHmtlz
    I have given some different names.

    The problem occurs as soon as I apply the “fix” for WooCommerce 8.6.0 via your patcher.

    So your fix replaces the cart-shipping.php with a “newer” version.
    The files are inside the path: /wp-content/themes/xstore/woocommerce/cart

    Once the fix has been carried out, no matter which theme I have active, the actual error message will not be displayed in the shopping cart during shipping for any theme.

    But as soon as I add the old cart-shipping.php again and overwrite the new php, it works again.

    This is how it should look: https://i.imgur.com/HsfqV7O.png (This is with the old cart-shipping.php)

    And this is how it looks with the new cart-shipping.php https://i.imgur.com/xIKgoB8.png

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    February 26, 2024 at 08:51

    Hello, ProdbyDaan,

    We would like to inform you that the patch in question only affects files within our theme, as evidenced by the following screenshot: https://prnt.sc/LR3keECAJDzP. It does not impact the files of other themes and is not implemented when a different theme is activated.

    In the most recent update, WooCommerce has made modifications to the cart-shipping.php file. Our patch is designed to incorporate these changes accordingly. When the Storefront theme is active, the cart-shipping.php file is sourced directly from the WooCommerce plugin, rather than from our theme. Consequently, our response remains consistent: the issue you are experiencing originates from the WooCommerce plugin itself.

    We trust that our explanation has been comprehensive. Should you require further assistance, we recommend reaching out to the WooCommerce support team, as it appears that their recent update may be the cause of the changes observed on your website, as well as for other users utilizing WooCommerce.

    Best Regards,
    The 8Theme Team

    Avatar: ProdbyDaan
    ProdbyDaan
    Participant
    February 28, 2024 at 08:12

    FYI WooCommerce found the issue they will fix it.

    https://github.com/woocommerce/woocommerce/issues/44920

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    February 28, 2024 at 08:43

    Hello, ProdbyDaan,

    Thank you for letting us know.

    If you have any other questions or concerns, please do not hesitate to reach out to us. Our support team is always available to assist you.

    Best Regards,
    The 8Theme Team

    Avatar: Andrew Mitchell
    Andrew Mitchell
    Support staff
    March 20, 2024 at 08:44

    Dear ProdbyDaan,

    In the spirit of gratitude, we want to express our appreciation for your trust in our products. As a valued customer, your experience matters greatly. Would you consider sharing it by giving our theme a deserving 5-star rating on ThemeForest?

    Click here to share your thoughts: https://themeforest.net/downloads

    Being part of our community means a lot, and your feedback contributes immensely.

    Best Regards,
    The 8Theme Team

  • Viewing 14 results - 1 through 14 (of 14 total)

The issue related to '‘WooCommerce Cart – No error message is displayed outside the shipping area’' has been successfully resolved, and the topic is now closed for further responses

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.