[et_pb_section bb_built="1" admin_label="section" _builder_version="3.0.51" next_background_color="#0e9117"][et_pb_row admin_label="row" background_position="top_left" background_repeat="repeat" background_size="initial"][et_pb_column type="4_4"][et_pb_post_title _builder_version="3.10.1" title="on" meta="off" author="off" date="off" categories="on" comments="off" featured_image="off" featured_placement="below" parallax_method="off" text_orientation="center" text_color="dark" text_background="off" border_style="solid" /][et_pb_text admin_label="Project categories" _builder_version="3.3.1" background_layout="light" text_orientation="center" border_style="solid" module_alignment="center"]
[project_categories]
[/et_pb_text][et_pb_image _builder_version="3.10.2" src="https://www.79mplus.com/assets/resume-banner-2.jpg" sticky="off" border_style="solid" animation_style="slide" animation_duration="500ms" animation_intensity_slide="10%" animation_direction="left" /][/et_pb_column][/et_pb_row][/et_pb_section][et_pb_section bb_built="1" specialty="off" _builder_version="3.3.1" background_color="#0e9117" prev_background_color="#ffffff" next_background_color="#ffffff"][et_pb_row _builder_version="3.3.1" background_position_1="top_left" background_repeat_1="no-repeat"][et_pb_column type="4_4"][et_pb_text admin_label="Challenge Text" _builder_version="3.10.2" background_layout="dark"]
Challenge
Our client had a WooCommerce based website for selling auto parts. They wanted to use Megabus.com.au 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
[/et_pb_text][/et_pb_column][/et_pb_row][/et_pb_section][et_pb_section bb_built="1" fullwidth="off" specialty="off" prev_background_color="#0e9117" next_background_color="#f9d339"][et_pb_row background_position="top_left" background_repeat="repeat" background_size="initial"][et_pb_column type="4_4"][et_pb_text admin_label="Our Solution (new)" _builder_version="3.10.2" text_orientation="center"]
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:
[/et_pb_text][/et_pb_column][/et_pb_row][et_pb_row background_position="top_left" background_repeat="repeat" background_size="initial"][et_pb_column type="1_3"][et_pb_text _builder_version="3.10.2" header_text_align="center" header_3_line_height="1.3em"]
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.
[/et_pb_text][/et_pb_column][et_pb_column type="1_3"][et_pb_text _builder_version="3.10.2" header_text_align="center" header_3_line_height="1.3em"]
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.
[/et_pb_text][/et_pb_column][et_pb_column type="1_3"][et_pb_text _builder_version="3.10.2" header_text_align="center" header_3_line_height="1.3em"]
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.
[/et_pb_text][/et_pb_column][/et_pb_row][et_pb_row background_position="top_left" background_repeat="repeat" background_size="initial" _builder_version="3.10.2"][et_pb_column type="1_3"][et_pb_text _builder_version="3.10.2" header_text_align="center" header_3_line_height="1.3em"]
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.
[/et_pb_text][/et_pb_column][et_pb_column type="1_3"][et_pb_text _builder_version="3.10.2" header_text_align="center" header_3_line_height="1.3em"]
Testing
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.
[/et_pb_text][/et_pb_column][et_pb_column type="1_3"][/et_pb_column][/et_pb_row][/et_pb_section][et_pb_section bb_built="1" specialty="off" _builder_version="3.3.1" background_color="#f9d339" prev_background_color="#ffffff"][et_pb_row background_position="top_left" background_repeat="repeat" background_size="initial"][et_pb_column type="4_4"][et_pb_image _builder_version="3.17.6" src="https://www.79mplus.com/assets/atoc-img.jpg" align="center" max_width="400px" animation_style="slide" animation_duration="500ms" animation_intensity_slide="10%" animation_direction="left" url="https://www.79mplus.com/assets/atoc-img.jpg" /][et_pb_text admin_label="Putting it all together" _builder_version="3.10.2" text_orientation="center" module_alignment="center"]
Putting it all together
When we finished, we delivered an automated WooCommerce synchronization plugin for Megabus API. It simplified inventory management for the client.
[/et_pb_text][/et_pb_column][/et_pb_row][/et_pb_section]