Request Custom Popup with Inquiry Form for Out-of-Stock Products

This topic has 6 replies, 2 voices, and was last updated 3 months, 2 weeks ago ago by Luca Rossi

  • Avatar: khurram virk
    khurram virk
    Participant
    August 16, 2025 at 11:30

    Dear Sir,

    Good day to you.

    I would like to customize the behavior of the out-of-stock products on my website. Currently, when a user clicks the “Add to Cart” button on a product that is out of stock, a default popup appears with the message:
    “Sorry, this product is unavailable. Please choose a different combination.”

    Instead, I want to replace this with a custom popup that shows the following:

    Message for Out of Stock Products:
    “Product is not in stock. Please submit your inquiry.”

    👉 Along with this message, an inquiry form should also appear in the popup for the user to fill in.

    Confirmation After Inquiry Submission:
    Once the form is submitted, the system should:

    Display a confirmation message:
    “We have received your request. You will receive a response shortly. Thank you for contacting SSTC. Contact No: 111111.”

    Send a confirmation email to the requester, acknowledging receipt of the inquiry and including the inquiry details.

    🔗 Example product (out of stock): https://safeandsecureksa.com/product/dakar/

    Can you please guide me on how to achieve this functionality?

    Thank you.

    5 Answers
    Avatar: Justin
    Luca Rossi
    Support staff
    August 17, 2025 at 16:27

    Dear @Khurram Virk,

    We kindly invite you to review the Waitlist feature available in the XStore theme. You can find detailed information at the following link:
    https://www.8theme.com/documentation/xstore/xstore-features/waitlist-feature/

    We hope you find this helpful.

    Best regards,
    The 8Theme Team

    Avatar: khurram virk
    khurram virk
    Participant
    August 19, 2025 at 10:32

    Dear Sir,

    Good day to you.

    I have a question regarding the out-of-stock variation message. Currently, when I select a product variation that is out of stock, the system shows the default message:

    “Sorry, this product is unavailable. Please choose a different combination.”

    Screenshot: https://snipboard.io/QN401F.jpg
    Product Link: https://safeandsecureksa.com/product/1-leg-wire-sling-master-link-on-top-and-legs-ending-in-thimble-hard-eyes/

    I would like to change this text to a custom message as follows:

    “Sorry, this item isn’t available right now. Submit your inquiry for details.”

    Could you please guide me on how I can modify this message in XStore?

    Thank you for your support.

    Avatar: Justin
    Luca Rossi
    Support staff
    August 19, 2025 at 13:58

    Hi @khurram virk,

    Please add the following code under functions.php file locates in your child theme:

    
    function n2t_text_strings( $translated_text, $text, $domain ) {
        switch ( $translated_text ) {
            case 'Sorry, this product is unavailable. Please choose a different combination.' :
                $translated_text = 'Your Custom Text Will Go Here';
                break;
        }
        return $translated_text;
    }
    add_filter( 'gettext', 'n2t_text_strings', 20, 3 );
    

    Hope it helps!

    Avatar: khurram virk
    khurram virk
    Participant
    August 21, 2025 at 11:17

    Dear Sir,

    Good day to you.

    I added the code snippet you provided into the functions.php file of my child theme, but unfortunately, it caused an error on my site. Please see the screenshot below for reference:

    🔗 Screenshot: https://snipboard.io/wzTQsG.jpg

    Can you kindly review the code and guide me with the corrected version so that I can properly replace the message?

    Thank you for your assistance.

    Avatar: Justin
    Luca Rossi
    Support staff
    August 21, 2025 at 13:01

    Dear @Khurram Virk,

    We hope this message finds you well.

    We would like to inform you that the provided code is functioning correctly on our local environment.

    Kindly ensure that the code is placed within the functions.php file located in your child theme directory, as shown below:

    
    function n2t_text_strings( $translated_text, $text, $domain ) {
        switch ( $translated_text ) {
            case 'Sorry, this product is unavailable. Please choose a different combination.' :
                $translated_text = 'Your Custom Text Will Go Here';
                break;
        }
        return $translated_text;
    }
    add_filter( 'gettext', 'n2t_text_strings', 20, 3 );
    

    If the code above is still not working, you can try with this one:

    
    function n2t_text_strings( $translated_text, $text, $domain ) {
        if ( $domain === 'woocommerce' ) {
            if ( $translated_text === 'Sorry, this product is unavailable. Please choose a different combination.' ) {
                $translated_text = 'Your Custom Text Will Go Here';
            }
        }
        return $translated_text;
    }
    add_filter( 'gettext', 'n2t_text_strings', 20, 3 );
    

    Additionally, based on the error message you provided, it appears that the issue is not related to our custom code.

    Should you need any further assistance, please do not hesitate to reach out.

    Best regards,
    The 8Theme Team

  • Viewing 6 results - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.