Hi,
To remove the shipping address map link and display it as plain text in the WooCommerce order preview modal, you’ll need to make some modifications to your theme’s template files. Specifically, you’ll want to override the template responsible for rendering the order preview modal. Here’s a step-by-step guide on how to achieve this:
- Create a Child Theme (Optional): If you’re not already using a child theme, it’s a good practice to create one. This ensures that your customizations won’t be lost when the parent theme is updated.
- Locate the Template File: In your WooCommerce plugin or theme folder, find the template file responsible for rendering the order preview modal. This file is typically named something like
order-preview.php
or similar.
- Copy the Template to Your Child Theme: If you’re using a child theme, create a directory within your child theme folder named
woocommerce
. Then, copy the order-preview.php
file from the parent theme or WooCommerce plugin into this woocommerce
folder within your child theme.
- Edit the Template File: Open the copied
order-preview.php
file in a code editor. Look for the section of code that generates the shipping address link, which might look something like this:
<?php if ( ! empty( $shipping_address_map_url ) ) : ?>
<a href="<?php echo esc_url( $shipping_address_map_url ); ?>" target="_blank"><?php echo esc_html( $shipping_address ); ?></a>
<?php else : ?>
<?php echo esc_html( $shipping_address ); ?>
<?php endif; ?>
- Modify the Code: Replace the code above with the following:
<?php echo esc_html( $shipping_address ); ?>
This modification will display the shipping address as plain text without a link to the map URL.
- Save the File: Save your changes to the
order-preview.php
file.
- Test: Visit your WooCommerce order list page and click the preview icon next to an order. The shipping address should now be displayed as plain text without a map link.
By following these steps, you should be able to remove the shipping address map link in the order preview modal. Keep in mind that template file locations and structures can vary depending on your theme and WooCommerce version, so the exact file and code may differ slightly. Always back up your files before making changes, and be cautious to avoid breaking your site.