Foxy Forum Status

We're no longer responding to questions via our forum, but we will keep it up for historical reasons. If you can't find the answer you're looking for, please visit our knowledge base or contact us. If there's enough interest in the future, we may bring the forum back.

Adding Additional Open Graph Tags in FoxyShop

brucepbrucep Member
in Help edited August 2013
Does anyone know if there is a custom hook for foxyshop to add additional open graph meta tags to product pages? It appears to currently generate og:type, og:title, og:url, og:site-name, and og:image. I'm getting ready to implement rich pins and would like to pull product info for the og:description (using the product:short description), og:price:amount (sale-price) and og:price:currency (not sure where this would pull from).
  • sparkwebsparkweb Member, Integration Developer, FoxyShop, Order Desk
    @brucep, Currently there isn't a hook for this, but I'd be happy to add one. In helperfunctions.php change the 'foxyshop_social_media_header_meta' function to read like this:
    //Set Social Media Meta Tags In Header (Facebook, Google+)
    //Google+ suggests you to put this in your <html> tag on the product pages: <html itemscope itemtype="">;
    function foxyshop_social_media_header_meta() {
    	global $product;
    	$product = foxyshop_setup_product();
    	echo '<meta property="og:title" content="' . esc_attr($product['name']) . '" />'."\n";
    	echo '<meta property="og:type" content="product" />'."\n";
    	echo '<meta property="og:url" content="' . esc_attr($product['url']) . '" />'."\n";
    	echo '<meta property="og:site_name" content="' . esc_attr(get_bloginfo('name')) , '" />'."\n";
    	if (foxyshop_get_main_image()) {
    		echo '<meta property="og:image" content="' . esc_attr(foxyshop_get_main_image()) . '" />'."\n";
    		echo '<link rel="image_src" href="' . esc_attr(foxyshop_get_main_image()) . '" />'."\n";
    		echo '<meta itemprop="image" content="' . esc_attr(foxyshop_get_main_image()) . '" />'."\n";
    	echo '<meta itemprop="name" content="' . esc_attr($product['name']) . '" />'."\n";
    	if ($product['short_description']) echo '<meta itemprop="description" content="' . esc_attr($product['short_description']) . '" />'."\n";
    	//Add Filter
    	echo apply_filters('foxyshop_spcial_media_header', "");

    And I will make sure this code gets included in the next version of FoxyShop.
  • Thank you. I don't mind mods on the helper function file as I track that file and mods in when upgrading.
Sign In or Register to comment.