Categories
Code Snippets WordPress

Jetpack Publicize with WooCommerce Products

add_action('init', 'kraft_woo_publicize');
function kraft_woo_publicize() {
  add_post_type_support( 'product', 'publicize' );
}

This code snippet, for your theme’s functions.php or in a core functionality plugin adds Jetpack’s Publicize feature to WooCommerce products. This would allow you to auto-post to Facebook, Twitter, Google+, etc when you post a new WooCommerce product to your site.

UPDATE: WooCommerce now includes Publicize support by default out of the box as of version 2.3.0. If you want to disable this feature, use the following code:

add_action('init', 'kraft_woo_publicize_remove');
function kraft_woo_publicize_remove() {
  remove_post_type_support( 'product', 'publicize' );
}

By Brandon Kraft

My life is an open-source book.

35 replies on “Jetpack Publicize with WooCommerce Products

I’d need to check into how Woo works a bit more. Generally, Twitter will use the message in the Publish metabox. Facebook will use the manual excerpt first and default to the auto-generated excerpt if none present.

ahh sweet.. what a wicked little snippet..
thanks so much..

Re the excerpt.. if using “yoast seo for woo commerce..”
There is a panel to specify/create custom content for sharing on social media. so targeting is much easier.. Its an amazing plug also .. 🙂

hello, i tried the code above but it doesn’t work. i use wootheme mystile and have jetpack & woocommerce plugin installed.

Sometimes, you can cycle the post status (e.g. Publish->Draft (save it as such)->Publish (re-save)) and it’ll go out.

Generally, Publicize aims for new posts so hitting older ones is a bit out of scope.

Hi Fuad, could you tell what kind of solution you find, I am still looking and was not lucky to find something yet…

.. first time functions.php user, immediate success. only two times blank screen,ehh. you’ve made me to puzzle it out, many thanks and snippet is magic, can’t wait to try it ..

Hi there,

Great post, and thanks for updating the info.

I’m encountering this when posting new woocommerce products. The Facebook page and G+ do get updated with a photo post, however the Twitter, Tumblr simply get a text post without any images.

Does anybody know of a work around for that?

Leave a Reply

Your email address will not be published. Required fields are marked *