Advertisement
majeedraza

WooCommerce - Add a product page button

Nov 19th, 2017
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.44 KB | None | 0 0
  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.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement