Support » Plugin: Preorders for WooCommerce » Can I show available data on single product page?

  • Resolved neal86


    Dear support,
    I set the preorder for this product, May I know show the available shipping date on a single product page and the checkout page?

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • I needed this too and it wasn’t showing for me either. I looked in the plugin and it should be adding it, but for some reason it’s checking against a setting that isn’t available. I’m guessing it’s only in the Pro version. Anyway you can overwrite this by adding this snippet to your child theme functions.php:

    add_action('woocommerce_before_add_to_cart_form', 'show_preorder_date', 12);
    function show_preorder_date() {
        global $post,$product;
        if ($product !== null) {
            if ('yes' == get_post_meta($post->ID, '_is_pre_order', true) && strtotime(get_post_meta($post->ID, '_pre_order_date', true)) > time()) {
                $timeFormat = date_i18n(get_option('date_format'), strtotime(get_post_meta($post->ID, '_pre_order_date', true))) ;
                $string = get_option('wc_preorders_avaiable_date_text');
                $text = str_replace('{date_format}', $timeFormat, $string);
                echo $text;

    You can also add this hook to display the date in the shop loop:
    add_action('woocommerce_after_shop_loop_item_title', 'show_preorder_date', 12);

    • This reply was modified 4 months, 4 weeks ago by Andrew.
    Plugin Author Niloy


    Hi @arapps92 ,
    the code snippet you provide is okay . but the woocommerce_before_add_to_cart_form is is already present in Shop.php file .
    but the woocommerce_after_shop_loop_item_title is okay for the show_preorder_date function .

    Hi @niloybrightvessel

    Yes, I can see woocommerce_before_add_to_cart_form in Shop.php, but it doesn’t work because of line 17:
    if ($product !== null && 'yes' == get_option('wc_preorders_avaiable_date_single_product')) {

    I can’t find wc_preorders_avaiable_date_single_product anywhere else in the plugin files or as a record in the website database, so this function is checking against an option that doesn’t exist. You’ve spelt avaiable wrong, but even with the correct spelling I still can’t find another mention of it.

    Is this a Pro only setting?

    My version of the function doesn’t include this check and it works perfectly.

    woocommerce_after_shop_loop_item_title will show the availability date in the shop loop so the customer can see the date before clicking into the single product. It would be good if you could add options to the settings page to allow us to show/hide the date on the single product page and the shop loop.

    @neal86 you can use the function above and combine it with the one below to add it to the checkout/cart page:

    add_filter( 'woocommerce_cart_item_name', 'just_a_test', 10, 3 );
    function just_a_test( $item_name,  $cart_item,  $cart_item_key ) {
    $product_id = $cart_item['product_id'];
        // Display name and date underneath
        echo $item_name.' <br/>Date goes here';
    Plugin Author Niloy


    Hi @arapps92 ,
    unfortunately, we skip this issue because we are testing it on the same local server where we test the pro version too. wc_preorders_avaiable_date_single_product is actually available in the pro version, and since it’s store the database in our server that’s why it’s working on our dev server always but not others.
    I am adding it to our to-do list right now and will fix it in the next release.

    – thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.