SA-MP and MTA Object Converter
- PUBLISHED ON:
- READ TIME: 3 mins
About the Project
The project was made for a client who wanted a system that could send emails when a WooCommerce product is bought after x working days. Of course, the client could use Mailchimp but this service was too expensive and my plugin version was exactly what the client wanted at a much lower price.
The first thing I did was the Email Templates. A specific category for templates was needed and after that, specifying in the plugin settings what the category is (not preconfigured, of course). The Email Templates are more exactly, private posts with the chosen category in the settings. This ensures that they will never be displayed on the page.
The second thing was building the relationship between the WooCommerce product and the Email Template. For this, a new Metabox was added to the Product Edit Page, where different Email Templates could be added to a product to be sent at an interval of n working days.
The last thing was capturing the event when a product was purchased. The product was checked if it had an Email Template attached and then if it did, it was executed on the spot or a Schedule was programmed to be executed together with the respective data. If the day value was 0, then it would execute directly, without any schedule. Before the email is sent, the content is processed and the bindings are replaced with the real values. The content is wrapped inside a WooCommerce Email class and is sent to the buyer.