Hello the Yoast SEO plugin not adding meta tags to Woocommerce Views Product Template.
I already created a ticket at the wordpress forum https://wordpress.org/support/topic/woocommerce-products-facebook-sharing-issues/#post-9693422
This is happening on all of my sites.
If I switch to the WooCommerce Plugin Default Template (doesn't display layouts) or deactivate the plugin everything works as expected.
Regards,
Nicholas
Hi I see that your Yoast SEO tags are omitted on single Product pages when WC Views Product Template is active. This issue has been reported to our developers as a compatibility problem, but unfortunately I do not have a timeline available for resolution just yet. I'll link your ticket to the escalated issue so I can update you as soon as I have some additional information to share here.
Thank you.
Actually I have a case on one site where I needed to add my own meta tags to the product pages. So this compatibility problems comes in quite handy. Only there of course.
I am referring to this ticket https://toolset.com/forums/topic/get-the-thumbnail-of-a-youtube-video-and-display-it-with-a-shortcode/ where you already helped me with.
It would be great if there was a way to control what meta tags are added to the site as I am using a custom image in one of the meta tags and wanted to improve the sharing.
function fb_opengraph() {
global $post, $product;
if(is_product()) {
$yt_thumbnail_url_1 = '<em><u>hidden link</u></em>';
$yt_thumbnail_url_2 = '/hqdefault.jpg';
//$img_src = '<em><u>hidden link</u></em>' . $yt_thumbnail_id . '/hqdefault.jpg';
if($excerpt = $post->post_excerpt) {
$excerpt = strip_tags($post->post_excerpt);
$excerpt = str_replace("", "'", $excerpt);
} else {
$excerpt = get_bloginfo('description');
}
?>
<meta property="og:title" content="<?php echo the_title(); ?>"/>
<meta property="og:description" content="<?php echo $excerpt; ?>"/>
<meta property="og:type" content="product"/>
<meta property="og:url" content="<?php echo the_permalink(); ?>"/>
<meta property="og:site_name" content="<?php echo get_bloginfo(); ?>"/>
<meta property="og:image" content="<?php echo do_shortcode ($yt_thumbnail_url_1.( '[types field="youtube-video-id-collaborator-1" output="raw"][/types]' ).$yt_thumbnail_url_2); ?>"/>
<meta property="og:image:secure_url" content="<?php echo do_shortcode ($yt_thumbnail_url_1.( '[types field="youtube-video-id-collaborator-1" output="raw"][/types]' ).$yt_thumbnail_url_2); ?>"/>
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@site">
<meta name="twitter:domain" content="<?php echo get_site_url() ?>">
<meta name="twitter:title" content="<?php echo the_title(); ?>">
<meta name="twitter:description" content="<?php echo $excerpt; ?>">
<meta name="twitter:image" content="<?php echo do_shortcode ($yt_thumbnail_url_1.( '[types field="youtube-video-id-collaborator-1" output="raw"][/types]' ).$yt_thumbnail_url_2); ?>"/>
<?php
} else {
return;
}
}
add_action('wp_head', 'fb_opengraph', 5);
Yes, it seems like Yoast SEO would be able to help you achieve that type of tag flexibility on a page-by-page basis but I am not sure. Sounds like a good question for their support team. If you need any information from me to help facilitate that, let me know.
Hi, we have released an erratum post with a patch available for WooCommerce Views:
https://toolset.com/errata/woocommerce-views-should-enforce-its-php-templates-as-late-as-possible/
A permanent solution will be included in the next release of WooCommerce Views. Please apply the patch and let me know if you continue to experience problems with Yoast SEO meta tags on the Product page.