I want to use WooCommerce but instead of buying from the site, the visitor will be redirected in Amazon. I want to change the "Add to Cart" href attribute with a URL specified in each product as a special attribute. I managed to get this working but the code seems a little bit messy- plus I had to change the plugin code - . Is there a way to make this in a more "proper" way?
<?php $meta = get_post_meta( get_the_ID(),'_product_attributes' );?> <a class="btn single_add_to_cart_button button alt" href="<?php echo $meta['amazon_url']['value']?> ">Buy from Amazon</a>