• Resolved Alan

    (@silverowlcbd)


    Hi. Help me solve the problem. My product variants should point to themselves and not to the main product. If I disable Yoast SEO, it works as I need it to.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Suwash

    (@suascat_wp)

    @silverowlcbd

    Thanks for reaching out!

    We asked our SEO experts about this, and their conclusion is that most of the time product variant pages are basically duplicate content, as nothing really changes in the content when you switch between variants. Our Yoast SEO treats nicely to these variant pages and canonicalizes them to the main product.

    If you check the difference between each variant when you change the size on the page, the content is basically the same. Having different URLs through the size parameters does not make each page unique, and having them indexed would cause duplicate content issues.

    If the content could be made sufficiently different between each product variant, then the recommendation would be to make a separate page for each product variant.

    I hope this clarifies your concern.

    Thread Starter Alan

    (@silverowlcbd)

    @suascat_wp

    I don’t have the option to make a separate page for each product variant. I synchronize inventory with a third-party service. That’s why I use the WooCommerce Single Variations plugin. I can write unique meta tags and description for each product variation. They will be unique.

    Plugin Support Maybellyne

    (@maybellyne)

    Hello Alan,

    Our plugin ensures that a product with attributes/variations will have a canonical URL that is the main product URL. This is also to prevent duplicate content issues.

    We don’t have an option that does otherwise, but you or your developer are free to extend the plugin to suit your desired needs.

    Thread Starter Alan

    (@silverowlcbd)

    This code solved my problem

    function ai_seo_change_canonical($canonical) 
    	{
    		global $product;
    		if(is_product() && !empty($_GET)) {
    			$variationID = (new \WC_Product_Data_Store_CPT())->find_matching_product_variation(
    			    new \WC_Product($product->get_id()),
    			    $_GET
    			);
    			if($variationID) {
    				$variation = wc_get_product($variationID);
    				if($variation) {
    					$canonical = $variation->get_permalink();
    				}
    			}
    		}
    	return $canonical;
    	}
    add_filter('wpseo_canonical','ai_seo_change_canonical');
    • This reply was modified 1 year, 3 months ago by Alan.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Canonical link points to the main product, not to a variant of the product’ is closed to new replies.