I’d like to add a button under the “Add to Cart” button which says “Buy on Amazon” and links to my Amazon product page [closed]

You can copy this code to your functions.php and you will add a button under Add to Cart Button. add_action( ‘woocommerce_after_add_to_cart_button’, ‘content_after_addtocart_button’ ); function content_after_addtocart_button() { echo ‘<div class=”content-section”><br><br><a href=”https://www.google.com/”><input id=”amazonBtn” type=”button” value=”Buy on Amazon”/></a></div>’; } Change the Google link for your Amazon link.

Custom user meta values in shortcode

You didn’t mention whether users could only reach this page when logged in, so this example includes a check to make sure the current visitor is logged in, otherwise it won’t output anything. <?php // create the shortcode add_shortcode(‘wpse_312268_show_cc_info’, ‘create_wpse_312268_shortcode’); function create_wpse_312268_shortcode() { // only do something if user is logged in if(is_user_logged_in()) { // … Read more