Removing or Modifying TB's WooCommerce Actions or Filters
I’ve been asked by a couple people how to modify the functions you’ve created that override default WooCommerce actions. In particular, how to:
1 – Change the href on the product image on the archive/shop page to have the product image link to the lightbox (as it does on the single product page) rather than link to the single product page.
2 – Remove the product thumbnail cross fade and just have the standard WC thumb functionality.
Both of these requests are related to the function added via the Theme_Blvd_Compat_WooCommerce class in the framework > compat > woocommerce > class-tb.compat-woocommerce.php file:
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail' ); add_action( 'woocommerce_before_shop_loop_item_title', array($this, 'show_product_image'), 20 );
So, in this class, you have removed the default WC product thumbnail loop and added your own. In each of these cases, the users should unhook your function and then hook back in their own function to the woocommerce_before_shop_loop_item_title hook location.
There’s a great discussion here http://hardcorewp.com/2012/enabling-action-and-filter-hook-removal-from-class-based-wordpress-plugins/ on how developers can enable users more flexible access to plugin’s (or in this case the parent theme’s) instance from outside the class.
Anyway, I’ve gotten as far as loading the remove action in a function that loads after_setup_theme, but nada. I almost have it but not quite. Help me! 🙂 I think learning how to work with these parent theme classes will be hugely helpful to everyone.
- You must be logged in to reply to this topic.