daily pastebin goal
92%
SHARE
TWEET

WooCommerce - Link shop straight to cart

lorro Jan 8th, 2017 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.   // WooCommerce - make shop and catalogue images link straight to cart
  3.   // code goes in functions.php for your child theme
  4.   remove_action( 'woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open', 10 );
  5.   add_action( 'woocommerce_before_shop_loop_item', 'my_loop_open', 10);
  6.   function my_loop_open() {
  7.     $cart_link = 'http://www.topcode.co.uk/solar_active/shop/cart/?add-to-cart='.get_the_ID();
  8.     echo '<a href="' . $cart_link . '" class="woocommerce-LoopProduct-link">';
  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
 
Top