By default in Magento 2.4.x there is a default necessity to manually set order status to Completed in admin tools, including Digital Products. Customer will not be able to download digital product until order status is Completed
Do we have a possibility for Digital Downloadable Products to have in case of successful transaction automatic Completed status for order without any manual activity in admin tools?
Thanks in advance
Solved! Go to Solution.
Your chat GPT promt generated code with some mistakes but it gave me the right direction to go. Thanks you sir! Your recommendation was very useful.
Here is the working solution that automates Digital Product Invoice in Magento 2.
https://medium.com/@serghei.topor/automatic-invoice-for-digital-product-in-magento-2-159b625e1344
According out of the box functionality it could be potential solution via Order Statuses in case if I associate Processing status with Complete state. I tried this solution - it doesn't work
An order will go into a complete state once it has both an invoice and a shipment. For virtual products, there is no need fro shipment so it will go into complete as soon as it has invoice.
All you need to do is invoice the order and it will go into complete, some custom code that will automatically issue an invoice if the order contains only digital products would suffice for your needs and it shouldn't be a lot of work.
So it must be an interceptor on Payment Succeeded event, and method that programmatically initiates invoice creation must be called in that interceptor?
I'm RoR developer & not familiar with Magento 2 architecture. Would be glad if there is an example with working solution & you would share a link for the gist with that solution (if it's possible).
Right now I'm thinking to write a custom outside service that will execute all necessary INSERTs/UPDATEs in MySQL that are using when you manually complete order from Admin Tools.
Thanks in advance
You should observe the sales_order_place_after event and hook your invoicing logic in there.
I don't have a working example of the code, but I checked and I think if you use what ChatGPT gives you for this prompt, it will work "Write a Magento 2 module that will automatically invoice any order that contains only downloadable products."
Your chat GPT promt generated code with some mistakes but it gave me the right direction to go. Thanks you sir! Your recommendation was very useful.
Here is the working solution that automates Digital Product Invoice in Magento 2.
https://medium.com/@serghei.topor/automatic-invoice-for-digital-product-in-magento-2-159b625e1344