WordPress to Salesforce Bidirectional CRM Integration

06/11/2019 5 min read Written by Daniel Lynton


Integration projects and integrations, in general, are a topic that we touch on in a lot of our posts, and our readers continue to ask for more. The reason for this demand is due to the sheer number of applications out there that excel in one area but fail to provide a complete solution. As a result, we end up with our leads in one application, our marketing efforts in another and our website in yet another.

Now we have three separate systems that need to work together pretty autonomously. Luckily for us, several applications out there have API support that allows us to connect multiple systems. So, with all the different systems and ways of connecting them, we have a constant flow of requests for information on what these integrations are capable of.

One of the most popular requests for CRM Integration revolves around Salesforce. Salesforce is an extremely powerful and flexible CRM that not only allows you to track contacts, leads, and customer information - it can also be customized to handle almost any kind of data. We have dealt with several customers who have product data stored in Salesforce that allows them to keep an accurate track of their inventory from right within their Salesforce portal, but they may have their actual store hosted on Shopify or another third party e-commerce solution. This means that without a custom integration stock adjustments would have to be made manually inside Salesforce immensely diminishing the value of keeping products inside Salesforce.

The Salesforce to WordPress Challenge

Another popular platform for hosting websites is WordPress, and it is one of the most frequent requests we receive for integrations. Recently, we were tasked by one of our clients to build a catalog of its products that were stored in Salesforce and display that catalog on a WordPress website we were to create for them. Because this was a catalog only we didn't have to supply e-commerce functionality (no cart or checkout), which was preferable to the client who wanted to drive leads to their sales team via Salesforce. This project had many challenges that we had to overcome but proved to be a feature-rich integration that the client was delighted with. Here are some of the challenges we faced:

  • We needed product updates in Salesforce to be immediately visible in the WordPress catalog.
  • When new products were added to Salesforce, they needed to be added to WordPress.
  • When a product was marked as sold in Salesforce, it needed to remain on the website (marked sold) for 14 days to allow customers to view similar products like that one.
  • The client required an advanced search engine to be able to search and filter through their catalog.
  • A form on each product detail page would feed contact details into HubSpot, and via the Salesforce connector would end up back in Salesforce. Product details had to be supplied with the customer's contact details to the HubSpot form for leads to be assigned appropriately to sales reps.
  • The client required an upload tool that allowed them to upload images directly to WordPress from within the Salesforce portal product pages.

Pushing New Salesforce Records and Updates to WordPress

The first challenge we overcame was handling, primarily, the method by which we were going to retrieve the product data. Salesforce has a robust API that would have allowed us to query for product details directly from the site on each page load without saving anything into WordPress - but at the cost of site load speed and responsiveness. We didn't want to sacrifice user experience for functionality, so we opted to import the product data into WordPress and maintain two records which would then be synced. To handle immediately showing changes to products after they are made in Salesforce we created an outbound message and workflow in Salesforce that would send the product details to WordPress so that we could keep the records synced at all times.

We built a relationship between Salesforce Record IDs and WordPress post IDs to know whether a record was an updated record or a new record to avoid duplicate products. This also allowed us to perform some custom operations at the time the file is updated or added, including determining whether or not the product was sold and if it was sold if it had been sold within 14 days of the current date. This allowed us to hide products that have been sold for more than two weeks and mark products that are recent sales appropriately in the system.

Salesforce Product Search Engine Powered by WordPress

To build the advanced search functionality that the client required, we created a couple of custom functions that triggered during the product update or creation action. These functions tagged the products with appropriate keywords and values so that we could leverage the powerful WordPress search engine to find and display product search results quickly. We did this by using custom taxonomies within WordPress for each type of filter that the client requested for their visitors to have at their disposal. This saved a great deal of computing power over the alternative of building a Salesforce API call for each combination of filters and search values.

Sending WordPress Website Leads Through Salesforce

A crucial part of our client's sales process was getting their leads into Salesforce so that they could be automatically assigned to a sales rep. However, we wanted also to help the client to utilize the power of HubSpot as well, so we relied on the Salesforce HubSpot connector to push form submissions through to Salesforce. We created a custom HubSpot form that accepted the Salesforce Record ID as a field so that when leads came through HubSpot into Salesforce, the system would know how to assign the lead. This allowed the client to track interest in products not only in Salesforce but also in HubSpot where they could see the number of visits to their product page concerning the amount of form submission on that page — highly useful tools to have for marketing and product optimization!

Handling WordPress Product Image Upload from within Salesforce

Building out a tool for the client to upload product images to WordPress from a Salesforce product record and have them automatically associated with the correct product within WordPress proved to be a fun challenge. Using custom s-controls, we were able to build an upload mechanism that was hosted in WordPress but was added to the product pages via a frame that allowed the images uploaded to it to be automatically associated with the proper product. We even provided the client with tools for selecting the primary image, deleting images, and also clicking through the images to find the end URL for report building and quote generation. We also were able to transfer all of the images already associated with the products that resided on a windows server (the old website) without data loss!

The Final Result: A Fully Integrated Salesforce Product Catalog

WordPress excels at displaying dynamic data, and after fully integrating Salesforce we now have a robust, user experience rich website that allows our client's customers to quickly and easily filter through products and find what is right for them. Our client has frequently come back to us with ideas for how to improve lead conversion rates by manipulating the Salesforce data as it comes into WordPress, like adding a hot deal sticker to products that have recently dropped in price. Once you have the data connected adding little customizations to the way that data is processed is straightforward and gives our clients who use Salesforce a lot of power in controlling exactly what they want the end user experience to be.

If you are interested in Salesforce integration with WordPress or any other system, do not hesitate to reach out to our team.

By: Daniel Lynton

Daniel is the founder and CEO of Lynton, a HubSpot Elite Partner specializing in all things integrated inbound marketing. Daniel started Lynton over 20 years ago as a teenager with a vision and Internet connection and has grown it to more than 30 employees serving clients worldwide. As CEO, Daniel guides his team with an innovative spirit, aiding in ideation and strategy. You can find him cooking, reading, or enjoying the mountains of Colorado when he's not propelling Lynton forward.

Subscribe Today

Stay Up-to-Date With HubSpot and Marketing Trends

Never miss a beat with the latest marketing strategies and tactics. Subscribe to the Lynton blog and receive valuable insights straight to your inbox.