Special Notes for Delivery Problem

Unwanted confusing text at checkout point

I created a 5 cent product to test my VISA payments. Everything went well except for one point. This is what the customers could read: Notes about your order e.g., special notes for delivery.  I’m planning on creating stores for local businesses. I decided that I must find a way to get rid of that unprofessional text.

I found that you have to onto your web host’s website and add some code. I hope WooCommerce will soon change that requirement. It seems to be way beyond the simplicity that WooCommerce users were promised.

Add to your functions.php file


You have to go to your WordPress child theme and add some code to the functions.php file. I’m using LiquidNet Hosting and my problem is in the Kelowna Virtual Assistant website. You will have to adjust these instructions to suit your situation. This is the order in which I did the operations.

  • LiquidNet Hosting website
  • Files
  • File Manager
  • Kelowna Virtual Assistant
  • wp-content
  • themes
  • twentysixteen-child
  • Right-click on functions.php.
  • Click Edit > with a plain text editor

The code

This is the code that was there already:

<?php
add_action( ‘wp_enqueue_scripts’, ‘wpsites_load_parent_styles’);
function wpsites_load_parent_styles() {
wp_enqueue_style( ‘parent-styles’, get_template_directory_uri().’/style.css’ );
}
register_nav_menus( array(
‘header’ => ‘Header menu’,
) );

This is the code that had to be added to the next line after that:

add_filter(‘gettext’, ‘translate_text’);
add_filter(‘ngettext’, ‘translate_text’);

function translate_text($translated) {
$translated = str_ireplace(‘Out of stock’, ”, $translated);
$translated = str_ireplace(‘Additional information’. ‘If you like our service, tell your friends. If you did not like it, tell us. We will make things better.‘, $translated);
return $translated;
}
// Hook in
add_filter( ‘woocommerce_checkout_fields’ , ‘custom_override_checkout_fields’ );

// Our hooked in function – $fields is passed via the filter!
function custom_override_checkout_fields( $fields ) {
$fields[‘order’][‘order_comments’][‘label’] = ‘Personalized Message’;
$fields[‘order’][‘order_comments’][‘placeholder’] = ‘Add message here’;
return $fields;
}

// Omit closing PHP tag to avoid “Headers already sent” issues.

The red text used to say Notes about your order e.g., special notes for delivery. So, you would create some text that would be appropriate for the Checkout area. Click on the save icon at the top of your page.

The Eight Theme website said: That text can be changed in Woocommerce file wp-content/plugins/woocommerce/includes/class-wc-checkout.php.

 

Related web pages

Changing the label & placeholder text at checkout
Customizing the WooCommerce checkout page

 

Note on child theme

The Customizing the WooCommerce Checkout Page web page referenced above says It’s very important that you first install a child theme and make updates to the functions.php file within it.  Do not make updates to the parent files because all customizations will be lost when you upgrade to the latest version of your theme.  The use of a child theme ensures that your hard work is preserved.