• Resolved eneko.astorkiza

    (@enekoastorkiza)


    Right now, someone can donate more than Fundraising Goal. there has to be a way to limit it, if someone donates 1/3, next one can’t donate the 3/3

    also Donation range has to be to the max of the fundraising goal…

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter eneko.astorkiza

    (@enekoastorkiza)

    i mean, a check for not allowing oversubscription

    Plugin Author Jonas

    (@flinnn)

    Hi enekoastorkiza,

    thanks for reaching out.
    This feature is actually quite complex since it requires inventory management. But you can the following code snippet to set a product to out of stock after a certain limit is reached:

    function set_donation_limit($revenue, $atts) {
        // TODO: use your product ID and your fundraising goal
        if ($atts["id"] == 1234 && $revenue > 10000) {
            $product = wc_get_product(1234);
            if ($product) {
                // Set the product to out of stock
                $product->set_stock_status('outofstock');
                $product->save();
            }
        }
    
        return $revenue;
    }
    
    add_filter('wcdp_progress_revenue', 'custom_wcdp_progress_revenue', 10, 2);

    Hope that helps,
    Jonas

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘don’t allow to donate more than Fundraising Goal’ is closed to new replies.