• Services

    IT SERVICES

    solutions for almost every porblems

    Ecommerce Development

    Enterprise Solutions

    Web Development

    Mobile App Development

    Digital Marketing Services

    Quick Links

    To Our Popular Services
  • Hire Developers

    Hire Developers

    OUR ExEPRTISE, YOUR CONTROL

    Hire Mangeto Developers

    Hire Java Developers

    Hire Node Developers

    Hire Shopify Developers

    Hire Android Developers

    Hire Angular Developers

    Hire Shopware Developers

    Hire iOS App Developers

    Hire WordPress Developers

    Hire A full Stack Developer

    Choose a truly all-round developer who is expert in all the stack you require.

  • Case Studies
  • About
  • Blog
  • Contact Us
Magento 2 Rich Text Schema Setup in JSON-LD: Step-by-Step Guide
Updated on 13/11/2024

Magento 2 Rich Text Schema Setup in JSON-LD: Step-by-Step Guide

ecommerce Magento Technical

In our previous blog, we discussed how Magento 2’s default schema markup doesn’t quite meet SEO needs straight out of the box. If your Magento 2 store relies on the default Magento template, it likely won’t qualify for showing up as a product card in Google search results. We provided a detailed guide on fixing the issues with the default Magento 2 schema, however there’s an even better approach: implementing schema using JSON-LD format. Unlike the Microdata format used by default in Magento 2, JSON-LD is more flexible and preferred for schema due to its ease of use and efficiency.

For those unfamiliar, schema markup plays a crucial role in making your eCommerce site more visible on search engines. By adding Rich Text Schema, search engines can better understand your content, which improves SEO and enables rich snippets (like product widgets) that give you more space in Google Search page and attract clicks and boost visibility.

How can you add Rich Text Schema Markup in JSON-LD to your Magento 2 store?

The first option is to get a 3rd party extension. There are plenty of options available, but make sure to do a basic research (check the demos) and then purchase it, most of the extensions struggle with Magento 2 Configurable products. We would recommend going for an SEO extension from reputed publishers like Amasty or Mageworks which along with schema fixes gives many more features for SEO as well.

However, if you prefer the more exciting DIY approach, you can add this schema yourself with some basic Magento and PHP knowledge. This guide will walk you through the steps for setting up Rich Text Schema for products and organization details, ensuring your Magento 2 store stands out with structured data designed for search engine success. Let’s dive in!

Note: These issues persist in the default Magento setups till version 2.4.7, so if you are using any 3rd party theme or SEO extension, or any newer version in future, then this solution might not work for you. If you are facing any troubles following the guide or fixing the schema, feel free to reach out to us.

Directory Structure

To make the required changes without them being overwritten by future updates, we’ll create a custom module. Here’s the basic structure:

Click here to view and edit & add your code between the textarea tags

Layout XML Configuration

Organization Schema Layout

File:

app/code/Azguards/RichTextSchema/view/frontend/layout/cms_index_index.xml

This file configures the layout for the CMS Index page, referencing the OrganizationSchema block to include the organization schema data

Click here to view and edit & add your code between the textarea tags

product Schema layout

File:

app/code/Azguards/RichTextSchema/view/frontend/layout/default.xml

This file configures the layout for the default page, referencing the ProductSchema block to include the product schema data.

Click here to view and edit & add your code between the textarea tags

Checkout Our Magento 2 Extensions

Creating templates Organization

Template File for organization schema

File

app/code/Azguards/RichTextSchema/view/frontend/templates/organizationschema.phtml
Click here to view and edit & add your code between the textarea tags

Organization Schema Block

File:

app/code/Azguards/RichTextSchema/Block/OrganizationSchema.php

This block class contains the logic to create and return the structured schema data as a JSON string.

Click here to view and edit & add your code between the textarea tags

Creating templates Products

Template File for Product schema

File

app/code/Azguards/RichTextSchema/view/frontend/templates/productschema.phtml
Click here to view and edit & add your code between the textarea tags

Product Schema Block

File

app/code/Azguards/RichTextSchema/Block/ProductSchema.php
Click here to view and edit & add your code between the textarea tags

Final Step: Deploy and Test Your Changes

After implementing the custom module, deploy the changes to your Magento store by running the following commands:

Click here to view and edit & add your code between the textarea tags

Once the deployment is complete, test your product schema markup using Google’s Rich Results Testing Tool. Enter the URL of a product page, test a simple and config product, and ensure everything is correctly recognized.

Would you like to share this article?

Share

need assisting with Magento 2 customization?

Feel Free To Contact Our Experts

All Categories

Artificial Intelligence
ChatGPT
Communication
ecommerce
Magento
News and Updates
Technical
UX and Navigation
WhatsApp API

Latest Post

  • Magento 2 Rich Text Schema Setup in JSON-LD: Step-by-Step Guide
  • Fixing Magento 2 Product Schema Markup | Missing “image” field FIX
  • How to Dispatch Custom Events in Magento 2
  • Adding Filters in Magento Admin Grid | Column and Non-Column Component
  • How to add custom styles (Colors and Fonts) to Magento Admin Grid

Related Post

  • Fixing Magento 2 Product Schema Markup | Missing “image” field FIX
  • How to Dispatch Custom Events in Magento 2
  • Adding Filters in Magento Admin Grid | Column and Non-Column Component
  • How to add custom styles (Colors and Fonts) to Magento Admin Grid
  • Introduction to Events and Observers in Magento 2

310 Kuber Avenue, Near Gurudwara Cross Road, Jamnagar – 361008

Plot No 36, Galaxy Park – II, Morkanda Road,
Jamnagar – 361001

Quick Links

  • About
  • Career
  • Case Studies
  • Blog
  • Contact Us
  • Privacy Policy
Icon-facebook Linkedin Google Clutch Logo White

Our Expertise

  • eCommerce Development
  • Web Development Service
  • Enterprise Solutions
  • Mobile App Development
  • Digital Marketing Services

Hire Dedicated Developers

  • Hire Full Stack Developers
  • Hire Certified Magento Developers
  • Hire Top Java Developers
  • Hire Node.JS Developers
  • Hire Angular Developers
  • Hire Android Developers
  • Hire iOS Developers
  • Hire Shopify Developers
  • Hire WordPress Developer
  • Hire Shopware Developers

Copyright @Azguards Technolabs 2025 all Rights Reserved.