Add Social Sharing to your WooCommerce product page with Jetpack

WooCommerce has a fantastic shopping cart plugin for WordPress. It includes a lot of custom hooks and filters too, that make extending it so much easier.

Out of the box, WooCommerce comes with social sharing capabilities via ShareThis. But I wasn’t crazy about having to run everything through ShareThis, and their interface is clunky on my front end. So I wanted to use my own, or at least one that I liked better.

Enter Jetpack. Jetpack is a set of features that are available to WordPress.com users, made available for self-hosted WordPress users. I use a derivative plugin called Slim Jetpack because it doesn’t require you to link it to a wordpress.com account.

Install Slim Jetpack, and set up its awesome sharing features. It is drag and drop, and easy for anyone to configure. Then check the box to enable it on product pages for your WooCommerce store.

By default, this will put social sharing below the description tab on the product page. This wasn’t where I wanted it. I wanted it to be more prominent, up by the Add To Cart button, which is where WooCommerce puts the ShareThis version.

Luckily, there is a filter designed to include the sharing component for WooCommerce. It’s called, appropriately, “woocommerce_share”.

Now, you need to add this to your functions.php file:

add_action('woocommerce_share','myshare');
function myshare(){
remove_filter( 'the_content', 'sharing_display', 19 );
remove_filter( 'the_excerpt', 'sharing_display', 19 );
echo sharing_display();
}

This removes the jetpack sharing from it’s ordinary location, and moves it to the new location, within the woocommerce product page.

Bad phishing

Sometimes I’m blown away at how poorly executed a phishing attempt can be. Here’s one of my latest favorites that just came today, presumably from “DHL system”:

Read

iPhone Tragedy Turned Customer Service Win

How much do I love Apple? As if people didn’t already know it, anyone who talks to me for the next month is going to get an earful about how much I love Apple. I have been an Apple fanboy for many years. I was even going to name my first son Mac ( I […]

Read
  • Anonymous Robot