Monthly Archives: January 2016

6 Modifying WooCommerce Product URLs

Before WooCommerce 2.5, it was possible to change/modify/override the URL to the product page using a filter on the the_permalink hook. For example, you could do this:

[php] add_filter( ‘the_permalink’, ‘mycode_the_permalink’ );
function mycode_the_permalink( $url ) {
global $product;
if ( ! empty( $product ) ) {
$url = ‘http://www.google.com’;
}

return $url;
}
[/php]

That would change all of the links to your product pages to a link to Google instead. If you felt compelled to give Google more Page Rank, you could do that. However, in version 2.5 of WooCommerce, that code no longer works.

Instead you need to remove WooCommerce’s woocommerce_before_shop_loop_item action and then re-add it again with your own function. Here’s a version:

[php] remove_action( ‘woocommerce_before_shop_loop_item’, ‘woocommerce_template_loop_product_link_open’, 10 );
add_action( ‘woocommerce_before_shop_loop_item’, ‘mycode_woocommerce_template_loop_product_link_open’, 20 );
function mycode_woocommerce_template_loop_product_link_open() {

$url = ‘https://www.datafeedr.com/’;

echo ‘<a href="’ . $url . ‘">’;
}
[/php]

Now all links to the product pages which are generated within the Loop on your site will be linked to Datafeedr! Yay! We could use a little help with Page Rank.

New “Media Library Filter” plugin released today

When your WordPress site starts to grow and you have lots of images in your library from Posts, Pages, Products and other WordPress content types, filtering the the media in your library becomes very difficult.

I thought for sure there would be a plugin available that would enable filtering of the media in my Media Library… but there wasn’t much. What I did find was a post on StackExchange from 2013 with a quick solution. So I spent a couple of days and put together the Media Library Filter plugin.

banner-1544x500

The Media Library Filter plugin allows you to filter the media in your library by taxonomy or term.

A taxonomy would be the type of category. For example some taxonomies might be Blog Categories, Product Categories, Post Tags, etc.

A term would be the name of an item in the category. For example the taxonomy Product Categories might contain the terms “Rock Climbing Shoes” and “Rock Climbing Helmets”.

If you have a suggestion or way to improve, please let us know.

Download the plugin

Enjoy!

Exclude duplicates based on Merchant ID

We’ve added a new option to the Exclude Duplicates filter in the Factory search form. Now you can also exclude duplicates based on the same merchant ID. This is useful if you want to create a list of the same product from multiple merchants without repeating any one merchant.

exclude-duplicates-by-merchant-id