Select Page

Stock Inventory Service Integration for Auto Parts based on Megabus API


Our client had a WooCommerce based website for selling auto parts. They wanted to use API to easily maintain and manage stock inventory of their products. So they were looking for an integration for Megabus with WooCommerce. They also wanted so that new orders are automatically updated to Megabus to show the latest inventory for managing product stocks.

Our task mainly was to:

  • Develop our own Megabus API Integration library
  • Implement Sync for new orders from WC to Megabus
  • Implement product sync with cron
  • Make PayPal payment confirmation to pass to Megabus
  • Testing the implementation carefully

Our Solution

The project involved having a new API integration with a few details to be taken care of.

Here’s how we solved the problem:

Megabus Integration

No official code was available for the Megabus integration in PHP. There was no third party integration as well. So we had to scour through the Documentation and cook-up an implementation of our own. The implementation is based on SOAP access to the API.

Sync for New Orders

Product stock quantity would have to match up with Megabus. To ensure that this happens, we had to send the new order data to Megabus for the stock quantity to be updated. We had to send the SKU to Megabus to ensure that the data is recognized by Megabus.

Product Sync with Cron

When new product records came on Megabus, client wanted to update the products on WooCommerce to be similar on both ends. So we had to prepare a script to update products from Megabus and run that script occassionally to update the products on WC. The script had to utilize role based pricing to serve both retail and wholesale customers.

PayPal Confirmation

Client wanted so that order payments are handled by PayPal. When PayPal transaction is confirmed, we send the signal to Megabus API. Megabus API then handles the stock quantity accordingly.


We had to test carefully and less frequently as possible because client could not provide us credentials to Megabus API for some company restrictions. We had to confirm each time we tested new orders. Later down the road we got a staging server, which made the testing process easier.

Putting it all together

When we finished, we delivered an automated WooCommerce synchronization plugin for Megabus API. It simplified inventory management for the client.

Are You Interested?

We can get you hooked to a similar project!

Get an estimate



Click one of our contacts below to chat on WhatsApp

× How can I help you?