Custom Flat Rate Description Text in Woocommerce checkout page
✔ Recommended Answer
The correct hooked function to add additional information to your shipping "flat rate" methods is:
add_action( 'woocommerce_after_shipping_rate', 'action_after_shipping_rate', 20, 2 );function action_after_shipping_rate ( $method, $index ) { // Targeting checkout page only: if( is_cart() ) return; // Exit on cart page if( 'flat_rate:1' === $method->id ) { echo __("<p>Arriving on your chosen date between 9am - 1pm Perfect for business addresses & special occasions</p>"); } if( 'flat_rate:2' === $method->id ) { echo __("<p>Arriving on your chosen date between 9am - 7pm Perfect for residential addresses</p>"); }}
This code goes on function.php file of your active child theme (or active theme). tested and works.
Source: stackoverflow.com
Answered By: LoicTheAztec
To add a custom flat rate description text in the WooCommerce checkout page, follow these steps:
- Go to your WordPress dashboard and navigate to WooCommerce > Settings.
- Click on the Shipping tab and then click on the Flat Rate shipping method.
- In the Flat Rate shipping method settings, scroll down to the "Method Description" field.
- Enter your custom flat rate description text in the Method Description field.
- Save your changes.
Now, your custom flat rate description text will be displayed on the checkout page for customers to see. It's important to note that the text you enter in the Method Description field will replace the default flat rate description text, so be sure to include all relevant information about your flat rate shipping method in your custom text.
Comments
Post a Comment