Support » Plugin: WPSSO Core - The Complete Meta Tag and Schema Markup Solution » Incorrect Meta Description and Title for WooCommerce Shop Page

  • Resolved wmiles

    (@wmiles)


    WPSSO is not generating correct Meta values for the WooCommerce Shop page Title and Description properties.

    The values being generated are from the last Product created. It appears the problem is related to an incorrect “Same As” relation to the Shop page that relates the Shop page to a Product page.

    The shop page is a special archive that lists products. It is not a Product and is not the same as a Product page.

    Correct values for the Shop page Title and Description do show in the Document SSO and Structured Data / Schema Markup box on the WordPress Edit form for the Shop page.

    Validating the Shop page from the Document SSO box shows that the JSON-LD markup being passed to the Structured Data Testing Tool has an incorrect “Same As” relation.

    
    @type WebPage
    @id https://www.bronzeart.ca/shop/#id/webpage
    mainEntityOfPage https://www.bronzeart.ca/shop/
    url https://www.bronzeart.ca/shop/
    sameAs https://www.bronzeart.ca/shop/spiegelbild-im-spiegel/
    sameAs https://www.bronzeart.ca/?p=7164
    name Spiegelbild im Spiegel
    description This work will be called Spiegelbild im Spiegel. The piece ...
    

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author JS Morisset

    (@jsmoriss)

    WooCommerce doesn’t setup the shop page very well for WordPress – it defines the $post object, for example, but assigns an ID of 0 to the $post object, so WordPress, WPSSO, and other plugins, cannot get additional information (like post metadata) from the shop page ID, only limited information based on the current $post object. When using get_the_title() with a post ID of 0, for example, WordPress returns the title for the current $post object (which is usually the first / newest product in the shop page).

    Unfortunately, the Free version of WPSSO Core does not include an integration module for WooCommerce, which fixes these little quirks and provides WPSSO with additional information about WooCommerce products (like additional product images, product variations, brand, color, condition, EAN, dimensions, GTIN-8/12/13/14, ISBN, material, MPN, size, SKU, weight, product reviews, product ratings, sale start / end dates, sale prices, pre-tax prices, VAT prices, and much more). In most cases, the WPSSO JSON Premium add-on is also desirable to replace the WooCommerce Schema JSON-LD markup, which is minimal and lacks important details for proper Google Rich Results.

    js.

    Thank you for your reply and your explanation of the issue.

    Your Free version of WPSSO can be repaired without the requirement to purchase your WooCommerce integration module. I would ask that you do this as the fix to correct the incorrect $post object is trivial. Once fixed, your product will no longer report incorrect markup for every WooCommerce site that chooses to use your free SSO version. This will improve the quality of your product.

    Thank you for your consideration.

    If you choose not to correct this, one way for others to resolve the issue in the Free WPSSO implementation is to include the following fix in the theme ‘functions.php’ file.

    
    // Fix WPSSO incorrect Shop page meta values and JSON-LD markup
    
    function filter_sucom_get_post_object( $post_obj, $use_post ) {
        if (function_exists('is_shop') && is_shop()) {
           $shop_page_id  = (function_exists('wc_get_page_id')) ? wc_get_page_id( 'shop' ) : -1 ;
           if ( $shop_page_id > 0) $post_obj = get_post( $shop_page_id );
         }
        return $post_obj;
    };
    add_filter( 'sucom_get_post_object', 'filter_sucom_get_post_object', 10, 2 );
    
    
    
    @type WebPage
    @id https://www.bronzeart.ca/shop/#id/webpage
    mainEntityOfPage https://www.bronzeart.ca/shop/
    url https://www.bronzeart.ca/shop/
    sameAs https://www.bronzeart.ca/?p=4
    name Bronze Castings
    description These are all my unique bronze castings. ...
    
    Plugin Author JS Morisset

    (@jsmoriss)

    FYI – The filter you provided breaks the ability to get different post objects from the shop page, like WooCommerce products and Media Library attachments. I would not suggest using this filter. Although we provide extensive developer documentation, I would always suggest using the Premium version if the desired feature already exists in the Premium version, as that feature will no doubt have been tested for many years and includes Premium support.

    For interested readers, here’s an example Schema Product markup for a WooCommerce product using the WPSSO Core Premium plugin and its WPSSO JSON Premium add-on:

    https://wpsso.com/docs/plugins/wpsso-schema-json-ld/notes/markup-examples/markup-example-for-a-woocommerce-product/

    js.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.