1. Home
  2. Knowledge Base
  3. WooCommerce Lead Time
  4. Advanced Usage

How to change the colon after the lead time prefix

When you are using WooCommerce Lead Time to display lead times with a prefix, then this will normally appear in the format "Lead time: 5 Days" on the cart, checkout and order details - i.e. separated by a colon. You have full control over the format of the lead time on the single product page, and the colon is not added there automatically.

This article is aimed at developers and explains how to replace the colon with a different symbol.

We've partnered with Codeable to provide our customers with expert help if required.

When the lead time is set to display on the Cart, Checkout, or Order details then the lead time data is sent to WooCommerce as item data. WooCommerce will then output this data in the relevant areas.

WooCommerce expects this data to be provided in a labelvalue format.

WooCommerce Lead Time sends the lead time prefix as the label, and the actual lead time as the value. If you do not have a prefix then the label will default to ‘Lead time'.

WooCommerce will then output this data separating the label and value (i.e. lead time prefix and the main lead time) with a colon.

If your lead time prefix already contains a colon : or dash - separator then WooCommerce Lead Time will automatically take this into account and send the item data without these separators so that WooCommerce can cleanly output the data using the default colon separator.

It is possible to customize the output of this in some areas and this would need to be handled within the scope of your theme or child theme. This is a complex developer-level task.

The output is handled by the wc_get_formatted_cart_item_data function in WooCommerce and this is used in various templates from WooCommerce.

An argument can be passed to the wc_get_formatted_cart_item_datafunction calls in the theme templates which tells it to use a custom cart/cart-item-data.php template in the theme.

It is important to note that any of these customizations would affect all item data that might be applied to a product and not just the lead time.

Related Articles

If searching the knowledge base hasn't answered your question, please contact support.