How to display product lead times elsewhere on your site
The WooCommerce Lead Time plugin can display product lead times on the single product page, shop page, product category pages, cart, checkout, and order details pages/emails. To ensure that the plugin works with all themes, we have coded it so that the lead time will only appear on the single product page, and not any other pages where your theme shows stock information.
We understand that you may sometimes wish to show lead times in order places where you display products, such as the shop or category pages. This article provides a choice of two methods for how to do this.
Using WooCommerce Product Table
The simplest way to display lead times away from the single product page is to use our other plugin, WooCommerce Product Table.
WooCommerce Product Table lets you list any or all of your products anywhere on your site. You can either add it to standard pages in WordPress, or to your shop and category pages.
When you use WooCommerce Lead Time together with WooCommerce Product Table, you can add a
lead_time column which displays the lead time within the product table.
Using WooCommerce Quick View Pro
If you don't want to list products in a table, then you can use another Barn2 plugin - WooCommerce Quick View Pro. This is also designed to work with WooCommerce Lead Time.
The plugin adds quick view buttons to your shop and category pages, allowing customers to view product information and purchase from a quick view lightbox instead of the single product page. Your lead times will appear in the lightbox, so it's an ideal way to show the lead time away from the product page.
Using WooCommerce Fast Cart
You can use WooCommerce Lead Time to display the lead time on the standard cart and checkout pages. If you don't want customers to have to visit separate pages to view these lead times and complete their order, then you can use WooCommerce Fast Cart instead.
This plugin works alongside WooCommerce Lead Time and the lead time appears in a popup cart and/or checkout. It's a great way for customers to complete their purchase without having to visit multiple pages.
Doing it programmatically
Alternatively, we have provided a template function so that you (or your developer) can display the lead time anywhere on your site.
Please note that this code is aimed at developers. If you don't know how to use it, then we recommend posting a job on Codeable where one of their pre-approved WordPress experts will send you a quote. We have partnered with them to provide customizations for our plugins.
You can retrieve the product lead time for custom display by using one of the following template functions:
- wclt_get_lead_time - retrieves the lead time with the the suffix and prefix.
- wclt_get_lead_time_raw - retrieves the lead time without the the suffix and prefix.
As an example, below we retrieve the lead time within a product loop.
$product = wc_get_product( get_the_ID() ); $lead_time = wclt_get_lead_time( $product );