Third & GroveThird & Grove
Jul 5, 2016 - Justin Emond

Drupal + Magento Integration

modern recreation of famous painting where adam and god's fingers are touching

When we needed to combine the power of Drupal’s CMS and Magento Digital Commerce to create best-in-class digital experiences for enterprise brands, there was only one way to do it: Build it ourselves. We pioneered a bi-directional, high-performing integration that gives our clients a flexible, customized experience, without the restrictions you’re used to.

Enterprise companies need to leverage the power of a strong CMS with a best-in-class ecommerce system, but for too long, none of the existing platforms on the market provided both. The Drupal + Magento integration is a hybrid solution that solves so many problems for enterprise (and smaller) companies, and it’s been amazing to watch it take off.

  • 40K+ Extensions: Unique add-ons to Drupal and Magento Digital Commerce modules, and more added every day.
  • 29.1% Marketshare: Magento Commerce leading the industry with the biggest adoption of any platform.
  • 350+ Commits: Constant updates to Drupal + Magento integration with more added daily.
  • 4 Years...and counting. The period of time that Magento Commerce has captured a quarter or more of their market.

Headless Digital Commerce

The idea of creating a hybrid Drupal CMS/Magento ecommerce store might sound like it would result in a complicated Frankenstein of a site, but it's actually, a clean, powerful, logical way to go, particularly for any company with a large sales volume that's looking to implement clever marketing content. Think about it: Drupal's ecommerce options barely exist, and Magento's not equipped to handle the kind of content that shoppers crave. Combine the two, and you've got best in class use cases for each system.

What does that mean, exactly? By combining the strengths of both platforms, you get a much more powerful site, capable of—well, anything, really: moving massive sales volumes, personalizing content to ages, regions, whatever; selling products internationally, in multiple languages; handling huge publishing flows; and making it possible for someone in L.A. to write new content that can be instantly approved by someone in New York. It means that you can launch your cool new Christmas promotion right when it should and a new feature that helps shoppers pick jeans by body type without having to check with IT first to see if you're going to break the site.

There's also a security bonus. When you decide to combine Magento and Drupal, there are two ways to go: headless, and side by side. With side by side, Magento handles the store, and Drupal handles the content; both platforms exist on the public Internet. Third & Grove opts for the headless option, where the Magento store takes care of all the commerce, but Drupal handles all content and the shopping cart; only Drupal features are ever on the live Internet, so the actual store is far more secure.

Going headless also saves time and money. When you go for the Drupal/Magento mashup, you need to make sure that all theming—colors, logos, etc—are created in both systems. But when you go headless, all your users will ever see is Drupal. No need to put in the work in Magento.

It’s less Frankenstein’s monster, and more a perfect hybrid machine, tailored to handle all of your content and ecommerce needs, and any needs you might have down the line.

Who has used it?

  • Mint.com - The company spun off from Intuit into its own site with everything from automated marketing to live chat and payments at any scale.
  • Docusign - The e-signature company saw the potential in marrying content and commerce.
  • Wilson - The sporting goods giant won the Commerce category winner at the 2016 Acquia Engage Awards.
  • Acquia - The leading enterprise platform for Drupal, will soon begin offering Drupal - Magento integration as a product.

Should You Go Headless or Side-By-Side?

Headless Pros:

1. Highly secure, as the ecommerce platform can be off of the public Internet

2. One platform to theme, instead of two (Drupal and Magento themes cannot be shared)

3. Does not require single sign on (SSO) between the two systems

4. More robust content marketing platform for editors

5. More powerful content workflow features

6. Fast time to market for content first sites needing digital commerce capability

Headless Cons:

1. Forward-facing Magento extensions will assume Magento is controlling the glass and may require additional refinements to work

2. While Magento has a robust, modern API architecture at its core, headless isn’t its most common use case

Side-by-side Pros:

1. Magento extensions are unlikely to be complicated by integration

2. Maximizes the value of both platforms, as both serve the glass at which they are good

Side-by-side Cons:

1. Twice the attack surface as headless (two platforms)

2. Two themes must be built and maintained

3. Breakdown of which pages should be served by which platform is not always clear during development

4. Drupal needs full stack performance tuning, while Magento needs only API-level tuning

5. Requires single sign on (SSO) integration

Drupal + Magento: Technical Specs

Ready to dig in even more? Here are some specifics from our engineers.

The integration is fully compatible with Drush, the powerful Drupal command line tool.

We built a Drush command that updates API endpoints and Oauth keys on the fly depending on the environment you are using. Whether it be local, dev, preprod, or any other server, all you have to do is run ‘drush reset-api-config,’ and it will automatically update the appropriate settings.

We opted to cache some Magento data in a Drupal table. Sometimes we need to clear out the data when we switch to a different Magento instance, so we created a command `drush wipe-magneto-cache-tables’ to delete all of the data. Then, using `drush cron,` we could sync up to the new instance.

We use cron hooks to update Magento data. That way, we can invoke cron with Drush to manually force a sync.

The integration is written to be easily extendable to support your own use cases.

We opted to cache Magento data in a Drupal table. Thus, when we add product attributes to Magento, we must also add them in Drupal.

There are different ways to approach this problem depending on the type of integration (headless vs side by side), and the desired product data administration experience. Generally speaking, you can divide the storage of product data between the two systems (core commerce data in Magento and presentation in Drupal), in which case you can handle custom presentation attributes at the Drupal node level and only sync core commerce fields from the commerce backend. Or, you can use the commerce backend as the entire system of record for all product data, in which case your integration needs to be able to query the Magento attribute set APIs to determine the custom field types and values for each attribute set.

Scaling was built into the integration from the ground up.

The product and promotional data required for display are synchronized (not pulled at render time), and the sync process uses an efficient method to pull product/promo updates (incremental).

API operations are combined and run in consistent order during the checkout flow to minimize API latency during real-time operations.

The cart and customer data is appropriately cached to minimize API traffic during checkout flows.

The Importance of Using a Conductor

A conductor platform is a critical component of ensuring fault tolerance for Acquia Drupal+ Magento integrations, especially at scale. A conductor stands between Magento and every integration system that is not a checkout blocker, holding requests until the system is available. That way, data isn’t slowed coming out of the store, and if a third-party system goes down, it will not take down your store. In many cases, only the payment system serves as a blocker, and you can dramatically reduce your single points of failure.

For example, if your store needs to send order information to Salesforce so that your customer support team has the information it needs, a delay of a few seconds won’t impact your business. Salesforce can go down—the data sending request can fail for any reason, really—and your digital commerce stays online.

Organize your stack like your team

When you integrate Acquia Drupal and Magento, you need to decide where product data lives and where marketing data lives. It's less important where product fields live, and more important to model the split of this data between Drupal and Magento on your internal marketing, merchandising, and technical teams.

Certain critical ecommerce fields like price, SKU, and stock should live in Magento, but product marketing information fields can be managed in Drupal.

It's also important to consider multilingual and global platform needs when modeling these fields, as certain teams may be in different time zones, using different languages, or have a-typical publishing flows.

FAQs

Do the connectors scale?

They do! We have clients uses these connectors at scale, through season and peaks like black Friday.

Is there a license fee to use these connectors?

Nope! The connectors themselves are open source and you use them right now, without needing to talk to us (but we don’t bite, we promise).

Are the connectors compatible with tax services like Avalara?

Yes, the connectors are fully compatible with tax service providers like Avalara.

Do the connectors support promotions?

They sure do. Promotions use cases can get very unique in commerce site so if the promotion isn’t supported out of the box you can extend the promotions connector to support your use case.

Does this integration work with Magento version 1?

Yes! TAG has built connectors for Magento version 1 and version 2.

Are these connectors for Drupal 7 or Drupal 8?

The Magento version 1 connectors are for Drupal 7 and the Magento version 2 connectors are for Drupal 8.

Do the connectors support commerce personalization tools like Adobe Test & Target, Acquia Lift, and Optimizely?

They do! These tools and others are fully compatible.

Does Drupal make live API calls for data or store or cache a copy of the data in the Drupal layer?

Both. When live data is absolutely necessary the connectors make highly efficient real-time calls. When it’s not, we use background processes to store and cache data in Drupal to ensure a performant yet data-relevant experience at the glass.

Are you saying the best method is to always do headless commerce?

No. There two primary ways to connect a commerce system with Drupal: side-by-side and headless. Both have pros and cons. It’s important to evaluate your requirements and plan a path forward based on your needs. If you seek outside help make sure your agency shares a Third & Grove core value: To be zealous advocates for our client’s technology. Only then are you ensured to get dispassionate recommendations from your agency that are in your best interest.

Do the connectors support every commerce use case?

That would be really hard! There are so many unique use cases in commerce that it’s impossible for any connector set to support every use case. The good news these connectors are built following best practices, meaning they are designed to be extended to support your custom use case. These connectors get you 90% of the way there, but there is inevitable customization needed on any modern, complex digital commerce effort.

What is the source of truth for commerce data, Drupal or the commerce platform?

It depends! We recommend storing the data in the system that is better at handling that data, but the connectors are flexible and you can customize this on a project by project basis. In general, we recommend attributes like description and images be stored in Drupal and price and stock be stored in the commerce platform.

Grab the integration guide

Read our detailed guide on integrating Magento and Drupal at enterprise scale. The guide is full of actionable insights like how to model your product data across two systems, a decision matrix for deciding headless or side-by-side, and how to maximize ROI with analytics.