The PierServ project was developed while working full-time at the Bertholdo Company and involved an on-demand integration between Wordpress and the Brazilian logistics system PierServ. The system specializes in the areas of promotional goods, finished products, e-commerce, and technology development focused on logistics of promotional materials and point of sale implementations.
Description
The project was composed of three different parts: one plugin, one cron, and one hook to fully synchronize data between the platforms. The plugin was implemented using the PierServ API to offer shipping methods based on the ZIP code inserted by the client. The API needs both city and state in order to provide results; however, WooCommerce only requires the ZIP code. Therefore, it was necessary to use an intermediate API to obtain the city and state corresponding to the ZIP code inserted and subsequently send them to PierServ. As a result, the available shipping methods, prices, and delivery time are shown to clients.
The cron (used to automate repetitive tasks or routines in the system) is responsible for synchronizing the products' stock between the platforms, updating the data on WooCommerce accordingly to what is set on PierServ. The sync occurs hourly; however, this can be changed to better match the client's needs. Furthermore, it is also possible to configure how many products should be synchronized each time (to avoid system overloading) and also the sync percentage, in case the client only wants a part of the stock to be reflected on WooCommerce.
Lastly, the hook (points of action that allow to change or add features without editing the Wordpress core) is used to send the orders made to the PierServ. Every time an order has its status changed to "Payment Made," the hook is fired and the order's information is sent to PierServ through their API. The request includes data such as payment method, shipping method, products purchased, and client information.