wordpresswoocommerceredux-framework

How to on/off woocommerce filter with redux framework


I am using this woocommerce filter in my function file

add_filter ('add_to_cart_redirect', 'redirect_to_checkout');

function redirect_to_checkout() {
    global $woocommerce;
    $checkout_url = $woocommerce->cart->get_checkout_url();
    return $checkout_url;
}

How can i get on/off system to this filter with redux framework. I already created Option in redux.


Solution

  • Just add redux global variable between function

      add_filter ('add_to_cart_redirect', 'redirect_to_checkout');
            function redirect_to_checkout() {
             global $xpanel;   if ( isset( $xpanel['woo-option'] ) && $xpanel['woo-option'] == TRUE ) {
            global $woocommerce;
            $checkout_url = $woocommerce->cart->get_checkout_url();
            return $checkout_url;
    
            }
        }