I'm sure it will come as no surprise that the reason it has been so long since I have published a post is because all of our lives have been turned upside down during this current crisis. My heart goes out to everyone doing it tough, as so many jobs - including people close to me have had their jobs be made redundant. Fortunately in my position, things have only gotten busier.
My day job is for a company in the field of wholesale distribution, and the when the virus has put us in lock-down, the Government called upon our company and other retailers to have a deliverable solution for essential items. Proud to say that while our company has never pulled something like this before - we did so in only 8 days. It only offered 4 item as packs of essentials, but we saw a great proof of concept.
Just as quickly, has it now expanded to the full product line, with registration now open to all and not those just who are most at risk. The solution we have applied is simple, but very elegant off the backbone of WooCommerce. With a vision to expand, this is just a stepping stone, but I would like to share some little tricks.
Getting Product Attributes
Certainly products will have varying attributes, such as if they are on special. I needed a way to extract this information as part of my API's, so it goes something like this:
Nice and easy, right? You could put this array as part of the products attached to an order.
Adding/Retrieving Order Comments
Having comments shared between all stake-holders is actually incredibly powerful. You can retrieve and send your own comments using the following API setup:
This has the dual ability to GET from a query string and POST by passing in JSON data parameters.
Modifying Order Status
To help modify the stages of fulfillment, you can create an API like this to change the status of an order:
This creates the POST capture from JSON data.
WooCommerce Events
Two primary events I am capturing as part of the native WooCommerce events are the following:
The first is triggered when the customer actions the order to complete their checkout process. From here, you can take the order (post) ID, and trigger any following part of your order workflow. Perhaps you want to send a notifcation to the retailer.
The second is part of Wordpress. This can be used that if any changes are made to the order, you can take the Post ID and if the post_type is "shop_order", you will know the order has been changed in some way, and you can evaluate if any action needs to be taken in this event.
I hope this adds some inspiration if you wanted to start the beginning of an online shop!
Comments
Post a Comment