• Resolved America Jr

    (@cmccrone)


    Im looking to fix some of the missing Schema fields. Whats the best way to acheive this?

    Screenshot: https://snag.gy/W43KMr.jpg

    Do you have a template for “product”?

    /**
     * Modifies the schema created by Site Reviews.
     * Paste this in your active theme's functions.php file.
     * @return array
     */
    add_filter( 'site-reviews/schema/LocalBusiness', function( array $schema ) {
    	$schema['address'] = [
    		'@type' => 'PostalAddress',
    		'streetAddress' => '123 Main St',
    		'addressLocality' => 'City',
    		'addressRegion' => 'State',
    		'postalCode' => 'Zip',
    	];
    	return $schema;
    });
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Gemini Labs

    (@geminilabs)

    Site Reviews provides schema options for all required fields of the “LocalBusiness” and “Product” schema types.

    To add additional fields to the “Product” schema, first use the Structured Data Testing Tool to see which remaining fields are recommended, then add the fields you need using the hook shown in the documentation FAQ.

    For example:

    /**
     * Modifies the "Product" schema created by Site Reviews.
     * Paste this in your active theme's functions.php file.
     * @return array
     */
    add_filter( 'site-reviews/schema/Product', function( $schema ) {
        $schema['sku'] = 'abcdef12345';
        // etc.
        return $schema;
    });

    Please note: Site Reviews is not intended to be a fully-fledged schema solution for your website, its goal is merely to add the rating schema for your reviews.

    If you need to connect or link the schema generated by Site Reviews to other schemas on your website (i.e. such as those created by Schema Pro), simply add a ‘@id’ field to the Site Reviews schema using the hook shown in the Documentation FAQ, and then make sure the schema you need to link to has the same ‘@id’ field.

    • This reply was modified 6 years, 1 month ago by Gemini Labs.
    • This reply was modified 6 years, 1 month ago by Gemini Labs.
    Thread Starter America Jr

    (@cmccrone)

    Ok, perfect. I somehow skipped over that option.

    I tried Googling this but couldn’t find anything. I was wondering how I would set the High and Low price if my product is only $49? I assume set both to $49.

    No worries if you’re not sure!

    Thanks

    Plugin Author Gemini Labs

    (@geminilabs)

    Site Reviews assumes multiple products, for this reason it uses the “AggregateOffer” in the Product schema as this allows variable pricing.

    Additionally, if you are using Woocommerce then the Site Reviews schema will automatically link to the Woocommerce schema.

    However, if you are not using Woocommerce and you selling a single product with a fixed price, you can modify the schema to change the “AggregateOffer” to “Offer” and set a fixed price from the “lowPrice” option. For example:

    /**
     * Modifies the Product schema created by Site Reviews to use a fixed price.
     * Paste this in your active theme's functions.php file.
     * @return array
     */
    add_filter( 'site-reviews/schema/Product', function( $schema ) {
        $schema['offers']['@type'] = 'Offer';
        if( isset( $schema['offers']['lowPrice'] )) {
            $schema['offers']['price'] = $schema['offers']['lowPrice'];
        }
        unset( $schema['offers']['lowPrice'] );
        unset( $schema['offers']['highPrice'] );
        return $schema;
    });

    Alternatively, if you are using a third-party plugin for your website’s schema you can simply unset $schema['offers'] and have that plugin handle those values. When you use the Product schema type, Site Reviews automatically adds the “@id” field to the schema with the URL of the page as the value. Simply add the same “@id” value to the other plugin’s schema and it will link with Site Reviews’ schema.

    • This reply was modified 6 years, 1 month ago by Gemini Labs.
    • This reply was modified 6 years, 1 month ago by Gemini Labs.
    Thread Starter America Jr

    (@cmccrone)

    Since these are global settings I have another question.

    I have 4 products not using the same system (like Woocommerce or course) and I’m curious what the best way would be to solve this.

    Would I use the low/high range in this case? I’m curious because I wouldn’t want my $49 course to show a range of $49 to $150 in the SERPs.

    1) Online Course (California):
    Cost: $49
    Post Type: LearnDash Plugin Course Page

    2) Online Course (Florida):
    Cost: $49
    Post Type: LearnDash Plugin Course Page

    3) Online Course (Start a Business):
    Cost: $100
    Post Type: LearnDash Plugin Course Page

    4) In-Person Course:
    Cost: $150
    Post Type: WordPress Page

    This should be my last thing. Thanks!

    Plugin Author Gemini Labs

    (@geminilabs)

    Simply add a schema_lowprice value on each course page:

    If you use the hook I sent you in the previous post, the schema_lowprice value will be used as the “price” for each page it is used on.

    You can verify this using: https://search.google.com/structured-data/testing-tool

    • This reply was modified 6 years, 1 month ago by Gemini Labs.
    Thread Starter America Jr

    (@cmccrone)

    That worked well!

    I had 7 warnings for some I didn’t use.

    I noticed “reviews” was one of them. The course does have 1 review but It’s not populating.

    Id like to add these but not 100% sure what the values would be. Then I would just add it my functions for each product?

    availability: (In stock?)
    url: https://dealer101.com/courses/california-dmv-continuing-education/
    brand: (Dealer 101)
    review: (*not counting the one 5 star review*)

    Structured Data Screenshot
    https://snag.gy/T80LZd.jpg

    Sorry if this is out of scope. Ive almost got it figured out then Ill be able to do it in the future.

    Plugin Author Gemini Labs

    (@geminilabs)

    1. To populate the “review” field, use the schema option on the [site_reviews] shortcode instead of on the summary.

    Here is the “schema” option documentation for [site_reviews]

    Here is the “schema” option documentation for [site_reviews_summary]

    2. To populate the “url” in the “offers” field, just add the URL in the code example above. For example:

    $schema['offers']['url'] = get_permalink();

    3. Add any of the other recommended (but not required) fields in the same way. For reference:

    4. I suggest you use Google to determine what values to use for the other fields.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Missing Schema Fields fro “Product”’ is closed to new replies.