Integrating Magento and WordPress using the WordPress REST API

04 Aug 2015

Interesting times are ahead of us. We’re happy to be the first company that developed Magento+WordPress plugin, and we’re happy that we’re able to do it publicly and openly (as in OpenSource). If you are interested in what we’ve done, and would like to contribute, head to our GitHub page, and feel free to join.

magento+wordpress

With Magento’s fairly poor out-of-the-box content management system (CMS), there was always a need for an integration with a more complete CMS solution. At StuntCoders, we never fail to give our best to our customers.

Therefore, whenever there was a need for blogging platform, we integrated WordPress to Magento.

Those two are match made in heaven, as one is truly born e-commerce platform, and other is truly born blogging & CMS platform. However, until now, it was always painful integrating those two as it was always required to run Magento inside WordPress and vice versa.

With the introduction of WP REST API plugin, Magento-WordPress integration just took an interesting turn. Through WordPress API Magento can now access posts, taxonomies and much more!

So, we decided to build stupid simple integration plugin that will allow to integrate WordPress blog into Magento store, seamlessly and easy. Store owner will then be able to write and maintain posts in WordPress’s powerful admin panel, while customer can read those posts without ever having to leave the Magento store.

This is beneficial for both design, optimizations and SEO.

StuntCoders Wp Rest

Integration comes in the form of StuntCoders Wp Rest module. While developing this module, our focus was on its simplicity. Module does not overwrite any core file and play nicely with other, third party, modules. StuntCoders Wp Rest module comes with almost no configuration and yet it offers so much.

Module allows you to access single post, page or list of posts from any category using SEO and user friendly URLs. Post with a slug “example-post” will be accessible at http://example.com/example-post (same goes for pages) and posts from category with a slug “example-category” will be accessible at http://example.com/example-category. In case WordPress category or post slug matches Magento’s category or product url key, priority will be given to Magento.

In the spirit of transparent Magento-WordPress integration, all posts displayed using StuntCoders WP REST module can contain any shortcode defined in your WordPress installation and will have identical content as if they are being viewed on WordPress.

WP REST API

None of this would be possible without the WP REST API plugin. WordPress API is, by many, referred to as the most innovating addition to this already powerful CMS platform, ever since the custom post types were introduced. This plugin must be installed on your WordPress blog in order to be able to use StuntCoders Wp Rest module. Goal of WP REST API plugin is to eventually become part of WordPress core.

Configuration

Module comes with only couple of configurable options:

  • API Endpoint – This field allows you to define the absolute url where your blog and its api reside. This means WordPress can be anywhere on the web, even on different domain than were your store is.
  • Homepage path (default value: site) – Allows you to define blog homepage. Blog homepage will show recent posts in descending order. With default value, your blog homepage would be at http://example.com/site

Plans for next releases

As WP REST API plugin develops so will the StuntCoders Wp Rest. With v2.0 and even core integration on a horizont for WP REST API, StuntCoders Wp Rest will keep up with these updates and implement new features brought by WP REST API. Our focus will still be module simplicity and backward compatibility, allowing seamless and painless module update.

One of the main upcoming features will be integration between Magento and WordPress search. Idea is to make search easier for customer by having only one search page which will return results from both platforms.

Another important feature is integration with our Simple Menu module, allowing to add blog pages as menu items.

Conclusion

Interesting times are ahead of us. We’re happy to be the first company that developed Magento+WordPress plugin, and we’re happy that we’re able to do it publicly and openly (as in OpenSource).

If you are interested in what we’ve done, and would like to contribute, head to our GitHub page, and feel free to join.

  • Was this helpful?
  • Yes   No
  • Back