Hello WooCommerce Customizers!
Episode #8 of my “18 snippets in 18 days” challenge (we have 10 days and 10 snippets to go) features a nice HTML hack.
Who doesn’t love hacks? 🙂
I remind you to share on social media and leave blog comments to support my marathon 🙂
Today we take a look at the WooCommerce Loop and specifically at how to disable the link to the products. Some store owner does not want to get people to the single product page, and simply have customers to add to cart!
WooCommerce Snippet: Disable Link to Products @ Loop
Thank you Daymobrew for your very elegant alternative to my initial hack 🙂 I love when 2 lines of code achieve a better result than 10!
/** * @snippet Disable Link to Products @ Loop * @how-to Watch tutorial @ https://businessbloomer.com/?p=19055 * @sourcecode https://businessbloomer.com/?p=19916 * @author Daymobrew * @testedwith WooCommerce 2.6.4 */ remove_action( 'woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open', 10 ); remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_product_link_close', 5 );