The global $woocommerce
can be reached, you just have to write global $woocommerce;
before using it. Read this article.
You can define your own shortcode, see the documentation. You can copy/paste the code because it’s wrapped in a class so it won’t trigger fatal error due to double declaration.
But shortcode do not work that way :
function shortcode_handler($atts) {
//code goes here
}
add_shortcode('name_of_shortcode','shortcode_handler');