woocommerce_add_to_cart_redirect

woocommerce_add_to_cart_redirect

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter
See hook in action

See hook in core

Displaying hooks found in version: woocommerce.9.5.1

apply_filters('woocommerce_add_to_cart_redirect') is found 2 times:

  • /includes/class-wc-form-handler.php line 819
    		}
    
    		// If we added the product to the cart we can now optionally do a redirect.
    		if ( $was_added_to_cart && 0 === wc_notice_count( 'error' ) ) {
    			$url = apply_filters( 'woocommerce_add_to_cart_redirect', $url, $adding_to_cart );
    
    			if ( $url ) {
    				wp_safe_redirect( $url );
    				exit;
    			} elseif ( 'yes' === get_option( 'woocommerce_cart_redirect_after_add' ) ) {
    				wp_safe_redirect( wc_get_cart_url() );
    
  • /includes/class-wc-frontend-scripts.php line 590
    				$params = array(
    					'ajax_url'                => WC()->ajax_url(),
    					'wc_ajax_url'             => WC_AJAX::get_endpoint( '%%endpoint%%' ),
    					'i18n_view_cart'          => esc_attr__( 'View cart', 'woocommerce' ),
    					'cart_url'                => apply_filters( 'woocommerce_add_to_cart_redirect', wc_get_cart_url(), null ),
    					'is_cart'                 => is_cart(),
    					'cart_redirect_after_add' => get_option( 'woocommerce_cart_redirect_after_add' ),
    				);
    				break;
    			case 'wc-add-to-cart-variation':
    				// We also need the wp.template for this script :).
    

See this hook used in plugins: