• Hi,

    When a coupon has reached its limits, I’d like to redirect users to a certain page, and not continue with the checkout.
    In class_wc_coupon.php there’s this code:
    private function validate_usage_limit() {
    if ( $this->get_usage_limit() > 0 && $this->get_usage_count() >= $this->get_usage_limit() ) {
    throw new Exception( self::E_WC_COUPON_USAGE_LIMIT_REACHED );
    }
    }
    Instead of throwing an exception error, I’d like to redirect. Doesn’t work…

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter strongcomet

    (@eitanshavit)

    Sorry, it does work. closed.
    private function validate_usage_limit() {
    if ( $this->get_usage_limit() > 0 && $this->get_usage_count() >= $this->get_usage_limit() ) {
    wp_redirect( home_url(), ‘301’ );
    }
    }

    Thread Starter strongcomet

    (@eitanshavit)

    Now, How do I get this as an action/filter in functions.php?

    Thanks!

    Eitan ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Redirect action’ is closed to new replies.