woocommerce – Show a popup message before redirect

i just wrote this functions: add_action(‘woocommerce_before_single_product’, ‘product_out_of_stock_redirect’); function product_out_of_stock_redirect(){ global $post; global $product; $terms = get_the_terms( $post->ID, ‘product_cat’ ); foreach ( $terms as $term ) { $product_cat_id = $term->term_id; break;…