Plugin Support
slash1andy
(@slash1andy)
Automattic Happiness Engineer
Hey there!
I think there’s a couple ways to do this.
* You can “translate” the text there to include “Free Shipping to Australia” or whatever you’d like to have there. You can use gettext or a plugin to do this.
* You can name a shipping method that.
* You can write a completely custom PHP template that would input the string you are looking for in the exact spot you were wanting.
Hopefully that helps! Have a great one!
Hi Andrew
Thanks for the reply.
What I am after is like a short paragraph of text beneath the “Shipping Calculator” heading. The gettext and translations are not applicable in this circumstance.
The custom PHP template (or an added snippet to the existing one) is most likely what I am after, but I am not a coder.
The section of the existing code is;
do_action( 'woocommerce_before_shipping_calculator' ); ?>
<form class="woocommerce-shipping-calculator" action="<?php echo esc_url( wc_get_cart_url() ); ?>" method="post">
<?php printf( '<a href="#" class="shipping-calculator-button">%s</a>', esc_html( ! empty( $button_text ) ? $button_text : __( 'Calculate shipping', 'woocommerce' ) ) ); ?>
<section class="shipping-calculator-form" style="display:none;">
<?php if ( apply_filters( 'woocommerce_shipping_calculator_enable_country', true ) ) : ?>
<p class="form-row form-row-wide" id="calc_shipping_country_field">
<select name="calc_shipping_country" id="calc_shipping_country" class="country_to_state country_select" rel="calc_shipping_state">
<option value=""><?php esc_html_e( 'Select a country…', 'woocommerce' ); ?></option>
<?php
foreach ( WC()->countries->get_shipping_countries() as $key => $value ) {
echo '<option value="' . esc_attr( $key ) . '"' . selected( WC()->customer->get_shipping_country(), esc_attr( $key ), false ) . '>' . esc_html( $value ) . '</option>';
}
?>
</select>
</p>
<?php endif; ?>
<?php if ( apply_filters( 'woocommerce_shipping_calculator_enable_state', true ) ) : ?>
<p class="form-row form-row-wide" id="calc_shipping_state_field">
<?php
$current_cc = WC()->customer->get_shipping_country();
$current_r = WC()->customer->get_shipping_state();
I think it needs to go after the <?php printf( '<a href="#"... line but before the country field is requested, but I don’t know how.
Most of the other templates for WooCommerce seem more straightforward as they don’t have heading or text within a form. I was able to work out how to add additional text for those, but not with this one.