Shopp Plugin Pinterest Rich Pins

Pinterest’s Rich Pins are a great way for clients to link their shopping cart products more deeply with Pinterest. It allows additional information like price, availability and location to be attached to the pin. I recently had a request to integrate the rich pins into a website and discovered no quick cut and paste solution for my clients (less popular) e-commerce WordPress plugin Shopp. Rich Pins essentially use Facebook’s Open Graph standard to implement the pins, so it didn’t seem like it was going to be a huge process. All the same I thought I’d share it here in hope of saving someone else a few minutes in the future.

Just to note unlike Facebook or Twitter this data will only be referenced once you clear your Rich Pin setup with Pinterest. A member of their team will visit your site and ensure they are set correctly. For more information about this and validating your Rich Pin pages see the Pinterest Rich Pin overview.

You’ll also need to manually set the currency, using the three letter codes available on XE. In my example the currency is set to AUD for Australian Dollars.

// Pinterest OG Tags            
if(function_exists('shopp')) {
    add_action('wp_head', 'shopp_rich_pins_head', 10);

    function shopp_rich_pins_head() {
        // Only run on product pages
        if(shopp('product.found')) {
            print '<meta property="og:type" content="product" />';
            print '<meta property="og:url" content="' . shopp('product.url', 'return=true') . '" />';
            if(shopp('product.has-images')) {
                print '<meta property="og:image" content="' . shopp('product.get-cover-image', 'property=url') . '" />';
            print '<meta property="og:title" content="' . shopp( '', 'return=true' ) . '" />';
            // Check if price is on sale
            if(shopp('product','onsale')) {
            	// Pinterest treats the 'ammount' as the regular price 
	            // or the sale price if the item is on sale.
            	print '<meta property="og:price:amount" content="' . shopp('product.saleprice', 'number=true&return=true') . '" />';
            	print '<meta property="og:price:standard_amount" content="' . shopp('product.price', 'number=true&return=true') . '" />';
		    else {
		    	print '<meta property="og:price:amount" content="' . shopp('product.price', 'number=true&return=true') . '" />';

            print '<meta property="og:price:currency" content="AUD" />';
            print '<meta property="og:site_name" content="' . get_bloginfo('name') . '" />';
            print '<meta property="og:availability" content="instock" />';
            print '<meta property="product:gender" content="unisex" >';