Skip to content

Latest commit

 

History

History
65 lines (58 loc) · 2.49 KB

README.md

File metadata and controls

65 lines (58 loc) · 2.49 KB

WooCommerce Variation Structured Data - Option 4

Changes the structured data output by WooCommerce as part of investigations into WooCommerce issue #17471.

If the query string contains the variation attributes to identify a specific variation of the product, then a variation specific Offer will replace the original AggregateOffer. E.g.

Note:
This is not intended as a final solution, or a long-term production plugin. Use it only if you are assisting with the investigation into WooCommerce issue #17471.

Standard WooCommerce behaviour. An AggregateOffer will be output with Min/Max prices.

{
    "@type": "Product",
    "@id": "http:\/\/www.example.com\/product\/variable-widget\/",
    "name": "Variable widget",
    "image": "http:\/\/www.example.com\/wp-content\/uploads\/2017\/10\/widget-grey.jpg",
    "description": "Lorem ipsum dolor sit amet, consectetur adipisicing elit.",
    "sku": "VARIABLEWIDGETSKU",
    "offers": [
        {
            "@type": "AggregateOffer",
            "lowPrice": "21.99",
            "highPrice": "27.99",
            "priceCurrency": "GBP",
            "availability": "https:\/\/schema.org\/InStock",
            "url": "http:\/\/www.example.com\/product\/variable-widget\/",
            "seller": {
                "@type": "Organization",
                "name": "WC Devbox",
                "url": "http:\/\/www.example.com"
            }
        }
    ]
}

A variation-specific Offer will replace the AggregateOffer.

{
    "@type": "Product",
    "@id": "http:\/\/www.example.com\/product\/variable-widget\/",
    "name": "Variable widget",
    "image": "http:\/\/www.example.com\/wp-content\/uploads\/2017\/10\/widget-grey.jpg",
    "description": "Lorem ipsum dolor sit amet, consectetur adipisicing elit.",
    "sku": "VARIABLEWIDGETSKU",
    "offers": [
        {
            "@type": "Offer",
            "price": "23.99",
            "priceCurrency": "GBP",
            "availability": "https:\/\/schema.org\/InStock",
            "url": "http:\/\/www.example.com\/product\/variable-widget\/?attribute_pa_color=red",
            "seller": {
                "@type": "Organization",
                "name": "WC Devbox",
                "url": "http:\/\/www.example.com"
            }
        }
    ]
}