• Resolved catwingz

    (@catwingz)


    The site is using the Storefront theme with Shippo, Flexible Shipping (free and Pro). I need to do more testing but I think all of the functionality has finally been sorted out. However there are issues with messaging in the cart. I’ve been told that these aren’t in the realm of Flexible Shipping.

    The primary remaining issue is that I think it is more confusing than helpful to have a prominently displayed message stating that “the customer matched zone Lower 48?+ DC”. See the attached screenshot. How can this be removed?

    In addition, what would be helpful would be if it is possible to display a message addressing customers in Alaska, Hawaii and Canada letting them know they need to contact us for a shipping solution. How can this be implemented?

    Thank you

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi,

    To remove the “the customer matched zone Lower 48 + DC” message from the cart in the Storefront theme, you’ll need to use some custom code. Additionally, you can add a message for customers in Alaska, Hawaii, and Canada. Here’s how you can do it:

    Removing the Existing Message:

    1. Create a Child Theme (if not already using one): It’s a good practice to use a child theme when customizing your theme to prevent your changes from being lost during updates. If you’re not using one, you can create it following WordPress guidelines.
    2. Locate the Cart Template: You’ll need to find the template file responsible for rendering the cart page. In the Storefront theme, this file is usually named cart.php. You can check the theme’s folder for this file.
    3. Edit the Template File: Open the cart.php file in your child theme or main theme directory. Look for the code that displays the message and remove it. The code may look something like this:
       <p class="shipping-message"><?php echo esc_html( $some_variable_containing_the_message ); ?></p>

    You can comment out or delete this line of code.

    1. Save Changes: After making the changes, save the cart.php file.
    2. Clear Cache: If you’re using a caching plugin, clear the cache to ensure your changes are reflected.

    Adding a Custom Message:

    To display a custom message for customers in Alaska, Hawaii, and Canada, you can use the wp_footer action hook to add JavaScript code that will display the message. Here’s an example of how you can do it:

    1. Edit your theme’s functions.php file: This file is located in your theme or child theme directory.
    2. Add the following code to functions.php:
       function custom_shipping_message() {
           if (is_cart() || is_checkout()) {
               ?>
               <script type="text/javascript">
                   jQuery(document).ready(function($) {
                       var allowedZones = ['AK', 'HI', 'CAN']; // Define the allowed zones
                       var userZone = 'AK'; // Replace with code to get the user's zone
    
                       if (allowedZones.indexOf(userZone) === -1) {
                           // Display a custom message for users not in the allowed zones
                           $('.cart_totals').prepend('<div class="shipping-message">Please contact us for shipping options.</div>');
                       }
                   });
               </script>
               <?php
           }
       }
    
       add_action('wp_footer', 'custom_shipping_message');

    This code checks if the user is on the cart or checkout page and whether they are in one of the allowed zones (Alaska, Hawaii, or Canada). If the user is not in one of these zones, it will display the custom message.

    1. Save Changes: Save your functions.php file.
    2. Clear Cache: Clear your caching plugin’s cache if you’re using one.

    This code will add the custom message for customers in Alaska, Hawaii, and Canada on the cart and checkout pages. Make sure to replace 'AK' with the appropriate code to determine the user’s zone based on your setup. You can also customize the message as needed.

    Thread Starter catwingz

    (@catwingz)

    Thank you @owadud655

    I got my websites mixed up. This one is actually using High Enterprise by Catch Themes. I am attempting to post on their support, but if you have any suggestions besides cart.php I’d love to know.

    It appears I have a new issue. How can I remove an address? I find I am unable to test the messaging for Alaska, etc because I had previously used another state and there doesn’t seem to be an option to change the address to one in a different state.

    Thank you

    Thread Starter catwingz

    (@catwingz)

    The theme developers have informed me that High Enterprise has no template for cart rendering and that it must be coming from Woocommerce. I’m back where I started with this. More guidance would be welcome. Thank you

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Shopping Cart messaging’ is closed to new replies.