Please submit a private ticket if you need to share sensitive information, such as license details and admin credentials.

Okay
  Public Ticket #3547243
Show a preety button if product not in stock on certain hours
Closed

Comments

  •  1
    Mykhailo started the conversation

    Hi. I'd like to display this button if the product is set to not in stock on certain hours. Is it possible to check in code whether the product is affected by this rule weX89XQ.png

    or is it checked by any rule in WPC product timer, so I could display this button. This is the only time range I want to hide lunch meals7DLVPPw.png

    Can you please answer on dev email [email protected], as he is responsible for this functionality

  •  767
    Janilyn replied

    Hi Mykhailo,

    Thank you for contacting WPClever Support Forum. 

    We’ve received your ticket and assigned one of our developers to help you with that. 

    He’ll be looking into your request to see if this is feasible or not and responding with specific instructions as soon as possible. 

    Please stay patient as we're having very heavy workloads, it might take some time for our developers to reach back.

    Best regards.

    Janilyn T. - WPClever Support Agent

  •  1,225
    Dustin replied

    Hi Mykhailo,

    We can't change the button text. However, I have an alternative solution is using a shortcode. Please add the below custom code (How to add custom code?):

    add_shortcode( 'wpc_unpurchasable_message', function () {
        global $product;
        if ( $product && ( ! $product->is_purchasable() || ! $product->is_in_stock() ) ) {
            return '<p style="color: red">This product is no longer available.</p>';
        }
        return null;
    } );

    Then use the shortcode [wpc_unpurchasable_message] where you want to display the message. Maybe right above the add-to-cart button.

    If it still doesn't work, please send me your website credentials (wp-admin link, username, password) then I can check and fix it for you. You also can create a dev/staging site with the same configurations then I'll work on it.

    Best regards,
    Dustin