• Resolved Jonah

    (@jonaho)


    Hi guys,

    It seems Facebook Microdata (Pixel usage) doesn’t allow structured product data being wrapped they way WooCommerce do. When having multiple structures present on a page (e.g. BreadcrumbList and Product), the nodes are being wrapped under the “@graph” node, according to the following code in class-wc-structured-data.php (row 91-95):

    // Wrap the multiple values of each type inside a graph... Then add context to each type.
    foreach ( $data as $type => $value ) {
      $data[ $type ] = count( $value ) > 1 ? array( '@graph' => $value ) : $value[0];
      $data[ $type ] = apply_filters( 'woocommerce_structured_data_context', array( '@context' => 'https://schema.org/' ), $data, $type, $value ) + $data[ $type ];
    }

    This isn’t recognized by the Facebook Microdata Debug Tool at all, but when I manually remove the wrapping and put the Product node directly on the root, it works just fine.

    Anyone seen this before? Can the Product node be lifted one level using the woocommerce_structured_data_product filter perhaps?

    Open to suggestions.

    Thanks

    • This topic was modified 4 years ago by Jonah.

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

Viewing 7 replies - 1 through 7 (of 7 total)
  • aetta

    (@chiape)

    Hi @jonaho

    I’ve checked the debug tool from Facebook, and it seems to be working fine with your site.

    You can also try to use this Chrome extension created by Facebook will verify that your Facebook pixel is working properly.

    If you’re still having issues with that, could you please share a copy of your site’s System Status? You can find it via WooCommerce > Status.

    Select “Get system report” and then “Copy for support”.  Once you’ve done that, paste it here in your response.

    Also, the woocommerce_structured_data_product controls the full set of data for the product, it passes an array and can be used to add/change values to your structured data.

    What’s the priority of execution of this filter on your code?

    I hope to hear from you soon! My very best!

    Thread Starter Jonah

    (@jonaho)

    Hi @chiape and thanks for your response.

    That’s strange as I’m getting the following result on Facebook Microdata Debug Tool:
    https://imgur.com/a/oeLEcSP

    WooCommerce Status Report results:

    
    ### WordPress Environment ###
    
    WordPress address (URL): https://smrtlab.se
    Site address (URL): https://smrtlab.se
    WC Version: 6.2.0
    REST API Version: ✔ 6.2.0
    WC Blocks Version: ✔ 6.7.3
    Action Scheduler Version: ✔ 3.4.0
    WC Admin Version: ✔ 3.1.0
    Log Directory Writable: ✔
    WP Version: 5.9
    WP Multisite: –
    WP Memory Limit: 256 MB
    WP Debug Mode: –
    WP Cron: ✔
    Language: en_US
    External object cache: –
    
    ### Server Environment ###
    
    Server Info: nginx/1.18.0
    PHP Version: 7.4.3
    PHP Post Max Size: 8 MB
    PHP Time Limit: 300
    PHP Max Input Vars: 1000
    cURL Version: 7.68.0
    OpenSSL/1.1.1f
    
    SUHOSIN Installed: –
    MySQL Version: 5.5.5-10.3.32-MariaDB-0ubuntu0.20.04.1
    Max Upload Size: 8 MB
    Default Timezone is UTC: ✔
    fsockopen/cURL: ✔
    SoapClient: ❌ Your server does not have the SoapClient class enabled - some gateway plugins which use SOAP may not work as expected.
    DOMDocument: ✔
    GZip: ✔
    Multibyte String: ✔
    Remote Post: ✔
    Remote Get: ✔
    
    ### Database ###
    
    WC Database Version: 6.2.0
    WC Database Prefix: wp_
    Total Database Size: 33.45MB
    Database Data Size: 24.55MB
    Database Index Size: 8.90MB
    wp_woocommerce_sessions: Data: 0.23MB + Index: 0.02MB + Engine InnoDB
    wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    wp_woocommerce_order_items: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_woocommerce_order_itemmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_actionscheduler_actions: Data: 1.52MB + Index: 0.73MB + Engine InnoDB
    wp_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_actionscheduler_logs: Data: 0.52MB + Index: 0.38MB + Engine InnoDB
    wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_comments: Data: 0.02MB + Index: 0.09MB + Engine InnoDB
    wp_duplicator_packages: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_options: Data: 2.34MB + Index: 0.20MB + Engine InnoDB
    wp_pmxi_files: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_pmxi_hash: Data: 0.09MB + Index: 0.00MB + Engine InnoDB
    wp_pmxi_history: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_pmxi_images: Data: 0.17MB + Index: 0.00MB + Engine InnoDB
    wp_pmxi_imports: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_pmxi_posts: Data: 0.08MB + Index: 0.00MB + Engine InnoDB
    wp_pmxi_templates: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_postmeta: Data: 5.52MB + Index: 4.52MB + Engine InnoDB
    wp_posts: Data: 11.09MB + Index: 0.63MB + Engine InnoDB
    wp_sbi_feeds: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_sbi_feed_caches: Data: 0.05MB + Index: 0.02MB + Engine InnoDB
    wp_sbi_instagram_feeds_posts: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_sbi_instagram_feed_locator: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_sbi_instagram_posts: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_sbi_sources: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_termmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_term_relationships: Data: 0.11MB + Index: 0.08MB + Engine InnoDB
    wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_usermeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    wp_wc_admin_notes: Data: 0.06MB + Index: 0.00MB + Engine InnoDB
    wp_wc_admin_note_actions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wc_customer_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_wc_order_product_lookup: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    wp_wc_order_stats: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    wp_wc_order_tax_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_wc_product_meta_lookup: Data: 0.19MB + Index: 0.42MB + Engine InnoDB
    wp_wc_rate_limits: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wt_iew_action_history: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wt_iew_cron: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wt_iew_ftp: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wt_iew_mapping_template: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_yoast_indexable: Data: 1.52MB + Index: 0.63MB + Engine InnoDB
    wp_yoast_indexable_hierarchy: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    wp_yoast_migrations: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_yoast_primary_term: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_yoast_seo_links: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    
    ### Post Type Counts ###
    
    attachment: 1296
    custom_css: 2
    customize_changeset: 13
    gp_elements: 6
    mc4wp-form: 1
    nav_menu_item: 6
    page: 10
    post: 1
    product: 208
    product_variation: 1218
    revision: 284
    saswp: 1
    shop_coupon: 2
    wcpa_pt_forms: 1
    wp_global_styles: 1
    wpcf7_contact_form: 2
    
    ### Security ###
    
    Secure connection (HTTPS): ✔
    Hide errors from visitors: ✔
    
    ### Active Plugins (15) ###
    
    Honeypot for Contact Form 7: by Nocean – 2.1
    Contact Form 7: by Takayuki Miyoshi – 5.5.5
    Duplicator: by Snap Creek – 1.4.4
    GenerateBlocks: by Tom Usborne – 1.4.2
    GP Premium: by Tom Usborne – 2.1.2
    Smash Balloon Instagram Feed: by Smash Balloon – 6.0.3
    MC4WP: Mailchimp for WordPress: by ibericode – 4.8.6
    Product Variations Swatches for WooCommerce: by VillaTheme – 1.0.2
    SMRTLAB: by SMRTLAB – 1.0.0
    WooCommerce Stripe Gateway: by WooCommerce – 6.2.0
    WooCommerce Shipping & Tax: by WooCommerce – 1.25.23
    WooCommerce: by Automattic – 6.2.0
    Yoast SEO: by Team Yoast – 18.1
    WP All Import Pro: by Soflyy – 4.7.2
    WP All Import - WooCommerce Import Add-On Pro: by Soflyy – 3.3.0
    
    ### Inactive Plugins (1) ###
    
    Cloudflare: by Cloudflare
    Inc. – 4.7.0
    
    ### Settings ###
    
    API Enabled: –
    Force SSL: –
    Currency: EUR (€)
    Currency Position: right_space
    Thousand Separator: ,
    Decimal Separator: .
    Number of Decimals: 2
    Taxonomies: Product Types: composite (composite)
    external (external)
    grouped (grouped)
    simple (simple)
    variable (variable)
    
    Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog)
    exclude-from-search (exclude-from-search)
    featured (featured)
    outofstock (outofstock)
    rated-1 (rated-1)
    rated-2 (rated-2)
    rated-3 (rated-3)
    rated-4 (rated-4)
    rated-5 (rated-5)
    
    Connected to WooCommerce.com: ✔
    
    ### WC Pages ###
    
    Shop base: #1237 - /shop/
    Cart: #1238 - /cart/
    Checkout: #1239 - /checkout/
    My account: #1240 - /my-account/
    Terms and conditions: ❌ Page not set
    
    ### Theme ###
    
    Name: GeneratePress
    Version: 3.1.3
    Author URL: https://tomusborne.com
    Child Theme: ❌ – If you are modifying WooCommerce on a parent theme that you did not build personally we recommend using a child theme. See: How to create a child theme
    WooCommerce Support: ✔
    
    ### Templates ###
    
    Overrides: –
    
    ### Action Scheduler ###
    
    Complete: 2,181
    Oldest: 2022-01-22 23:21:02 +0100
    Newest: 2022-02-19 16:46:26 +0100
    
    ### Status report information ###
    
    Generated at: 2022-02-19 20:33:39 +01:00
    

    All the best

    • This reply was modified 4 years ago by Jonah.
    • This reply was modified 4 years ago by Jonah.
    Thread Starter Jonah

    (@jonaho)

    Priority of the filter hook is 10. But even with the hook inactivated/removed I still don’t get any results for JSON-LD using the Facebook Microdata Debugger.

    • This reply was modified 4 years ago by Jonah.
    aetta

    (@chiape)

    Hi @jonaho

    Just to clarify it a bit more, are you adding Schema through the YOAST SEO plugin?

    I am asking this because I didn’t find any Schema on your site using the Google Structured Data testing tool

    Can you double-check if everything is set as stated on their documentation?

    https://developer.yoast.com/features/schema/plugins/woocommerce-seo/

    You can also try different plugins for that searching for “WooCommerce Schema” on the plugins repo.

    Additionally, I’d recommend checking if it isn’t been overwritten, by your theme or any other plugin.

    The best way to determine this is to:

    • Temporarily switch your theme to Storefront
    • Disable all plugins except for WooCommerce
    • Try do add your Schema markups using a plugin or custom codes and check it again.

    A staging site would be a good idea at this point. If your host doesn’t offer that option, we recommend WP Staging for quickly spinning up a new test site.

    Let us know how it goes! Thanks

    Thread Starter Jonah

    (@jonaho)

    Hi @chiape,

    The YOAST Schema and structured Data has been inactivated. The only Schema loaded with the page and site is the one provided from WooCommerce. This can also be seen by using the Schema Markup Validator:

    https://validator.schema.org/#url=https%3A%2F%2Fsmrtlab.se%2Fproduct%2Fcap%2F%3Fv%3Df003c44deab6

    We’ll do some more testing on our staging environment and deactivate plugins.

    Thanks,

    Hi @jonaho

    Thanks for the update.

    Please keep us informed on your findings from testing on the staging environment.

    Cheers

    Hey Jonah! We haven’t heard back from you in a while, so I’m going to mark this as resolved – we’ll be here if and/or when you are ready to continue.

    All the best!

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘“@graph” wrapping error in Structured Data’ is closed to new replies.