I fetch a specific product in a page that is outside of woocommerce template and I need to add the 'Add to cart' button. I looked at the code and I saw woocommerce doing it this way,
<a href="/?product_cat=icecream&add-to-cart=77" rel="nofollow" data-product_id="77" data-product_sku="" class="button add_to_cart_button product_type_simple">Add to cart</a>
I tried to change the product_id and everything to be fit to my needs like this,
<a href="/?product_cat=icecream&add-to-cart=<?php echo $id; ?>" rel="nofollow" data-product_id="<?php echo $id; ?>" data-product_sku="" class="button add_to_cart_button product_type_simple">
<img src="<?php echo get_bloginfo('template_directory'); ?>/images/add_to_cart.png" alt="Add to cart" />
</a>
but it dosen't get saved for some reason (when I get into cart page its empty). I'm trying also to lose the "View Cart" button that gets near when the item is added, if someone can guide me how can I create that button and where to shall I redirect it, it would be perfect (:
thanks !