• Resolved kb0wwp

    (@kb0wwp)


    I have a woocommerce store with a popular product. I’m finding it hard to source all the parts to keep up with the demand, so I have created a waiting list signup form on the product page.

    I now have enough items to fulfill about a third of the signups on the waiting list, but I’m looking for ways to handle this. Ideally I’d like to send out emails in the order they signed up with a coupon code that would allow them to purchase. Is this possible?

    I know I can create a password protected page for the item, but I would like everyone visiting the site to be able to see the item and sign up for the waiting list.

    I’m very comfortable with PHP/JavaScript/jQuery so I can do something custom if necessary.

    Has anyone done this before and how did you do it?

Viewing 1 replies (of 1 total)
  • Thread Starter kb0wwp

    (@kb0wwp)

    I figured something out. I’m using CSS to hide the “Add to Cart” button (and everything in form.cart). Then using this code in functions.php to load a style sheet that shows the form:

    add_filter( 'the_content', 'my_allow_purchase_filter' );
    
    function my_allow_purchase_filter( $content ) {
        $pos = strpos($_SERVER['REQUEST_URI'],'?allow=true');
        
        if ( $pos !== false ) {
            wp_enqueue_style('secretitem', get_stylesheet_directory_uri() . '/secretitem.css');
        }
    
        return $content;
    }

    Here’s the content of my normal CSS for the product:

    p.in-stock {
        display: none;
    }
    
    form.cart {
        display: none;
    }

    Here’s the content of secretitem.css:

    p.in-stock {
        display: block !important;
    }
    
    form.cart {
        display: block !important;
    }
    
    div.woocommerce-product-details__short-description {
        display: none;
    }

    This way, I can email a “secret” URL that allows the item to be purchased, and everyone that goes to the page without the query string gets an “out of stock” message (which I have in the short description).

    • This reply was modified 5 years, 1 month ago by kb0wwp.
    • This reply was modified 5 years, 1 month ago by kb0wwp.
Viewing 1 replies (of 1 total)
  • The topic ‘How to handle waiting list?’ is closed to new replies.