Your social media marketing can be an important branding and customer service strategy, so we’ve already discussed how to get better at social eCommerce. One of the things you can do is add sharing buttons to your product pages so that customers can easily share your products when visiting your store.
There are a couple of ways you can add social sharing buttons to Easy Digital Downloads to make sharing your products easier. If you like to tinker with (read: hack at) your site, you might want to add these buttons in different places yourself, which we’ll show you how to do today.
A couple suggestions before we get started: First, make sure you’re adding this code to your site correctly. Here’s a tutorial on how to add code to WordPress if you’ve never done this. Second, it’s helpful to ensure that your site is optimized for social sharing. There’s a free plugin (WPSSO) that will help with this, but the Pro version supports formatting EDD product shares as well.
If you’re okay with a more limited selection of buttons than you’d get by manually adding your own buttons, you could use Jetpack sharing to add these buttons instead. You won’t have the option to add the buttons in different locations, but this tutorial will walk through how to do this with custom code.
You can use Jetpack for the purposes of this tutorial, or the standalone Jetpack sharing module instead of you don’t already use Jetpack or if you don’t want to sign up for a WordPress.com account.
When you install the plugin and go to Settings > Sharing, make sure that you’re showing sharing buttons on download pages.
This will display the sharing buttons at the bottom of every download page, right after your purchase links.
Note that I’ve added a tiny bit of CSS to my child theme to center the social sharing buttons and remove the top border, which you can add to your own child theme if desired:
div.sharedaddy.sd-sharing-enabled { text-align:center; margin-top:10px; } h3.sd-title::before { border:none !important; }
If you’re happy with the buttons being there, you’re done! If not, keep going ๐ .
I’ll be using the tiny styling tweak above throughout these examples. Please note that these code examples may not display in exactly the same way as they have here in your own theme, so you may have to tweak them further.
Choose one of the following examples to move your Jetpack sharing buttons on Easy Digital Downloads product pages.
Let’s first move the download buttons above my content instead of after it. We can do so using this snippet:
(Thanks Patrick Rauland for the idea on this snippet.)
Note that there are a couple things going on. First, we check to be sure the sharing_display
function is available, meaning the Jetpack sharing is activated, so we don’t have errors. Next, we remove and re-add the sharing buttons in our desired place. In this case, the edd_before_download_content
is used, which is only called on single download pages. This will add social sharing buttons after my download title on every download page.
What if you want to display the buttons after the description instead? We can use a very similar snippet, which will allow us to add sharing buttons right before the purchase link. Note that in this case, my snippet has to use an additional check: we have to use is_singular('download')
to be sure we’re on a single download page, since the edd_purchase_link_top
action we’re using is also used for the [downloads]
shortcode (which you may use to create a “shop” page).
This will add social sharing buttons to all downloads right before the purchase link / “Add to cart” button instead.
If you frequently use variable products, you may want to display your sharing buttons between the description and the variable pricing options. We can do this as well, but our snippet is getting a bit more complicated.
We’ll have to still check that our function exists and that we’re on a download page, but we’ll also need to check that our product has variable pricing options. If it does, we’ll add the buttons before the pricing options using the edd_before_price_options
action. If there are no variations, we’ll need to add buttons using the edd_purchase_link_top
action again since the edd_before_price_options
action won’t exist on the page.
This will add buttons above and variation pricing options if they exist:
If variable pricing is not enabled for the product, the buttons will be added above the purchase link again instead:
Finally, what if you frequently use product images? You may want to add social sharing buttons right after these images instead. As downloadable products may not have an image, this probably won’t apply to many stores, but we can filter the post thumbnail and tack the sharing display after it.
First, we check that the function exists and that we’re on a download page. Next, we see if the post has a thumbnail. If it does, we filter the thumbnail to add the sharing display after it. If there is no thumbnail, we’re going to add the sharing display right after the title again instead.
Now my single downloads will show sharing buttons right after the image if set:
If there is no featured image, then sharing buttons will display in the same place as they did in my first snippet — right after the download title:
I’d love to hear about it if you end up using this trick on your site! Link up your download page in the comments ๐ .
Great ideas Beka! I really love your post plus your ideas enlightened me so much about social sharing buttons and its importance when building a website for your business. Also, as I go on with my search for more information about it, I stumble upon this article http://www.lionleaf.com/blog/where-to-place-social-sharing-buttons-on-your-pages/ which gives me relevant results and ideas too but your post is much more interesting and is easy to understand. By the way, do you happen to have any more ideas on what kind of social sharing practice would a beginner use when building a site in the near future? Hope to hear your thoughts about this. Thanks!
Hey Gene, so glad to hear this was helpful! One of the extensions I like for Easy Digital Downloads is great for a new site because it encourages customers to share your products to get the word out about them. You can give them a discount for sharing your products using Social Discounts. I recommend using sharing buttons near your purchase button (I prefer to use them after it), but this would make a good testing point — move them on the product page and see where you get the most shares over time. Cheers!