Unable to call woocommerce hook in my custom php file

You are doing it all wrong, place your code like the following in your file. <?php echo ‘hook called’; // This is not showing any message exit(); global $woocommerce; $product_id = $_POST[‘selected_package_id’]; echo $product_id; // This is not displaying id exit(); $found = false; //check if product already in cart if ( sizeof( WC()->cart->get_cart() ) … Read more