WooCommerce - Add a product page button

lorro Nov 19th, 2017 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.   // WooCommerce - Add a product page button
  3.   add_action( 'woocommerce_after_shop_loop_item', 'replace_add_to_cart', 10 );
  4.   function replace_add_to_cart() {
  5.     global $product;
  6.     $link = $product->get_permalink();
  7.     $link = esc_attr( $link );
  8.     print '<a rel="nofollow" href="'.$link.'" data-quantity="1" data-product_id="168" data-product_sku="" class="button product_type_simple add_to_cart_button">SHOP NOW</a>'.PHP_EOL;
  9.   }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand