Improving performance on Place Order flow and Editor #46885
Replies: 8 comments 2 replies
-
I think the 2nd solution could work with minimum technical effort if it's clear to merchants that the section only shows when there is a downloadable item attached to the order. But it might add to some confusion on the merchant end, especially if there are customizations added to this page and the store doesn't offer digital assets. Basically, the Editor view of the page would not match the actual confirmation page, which is mostly not aligned with how we handle the other checkout blocks editor: we strive to align the structure of the blocks with what the shopper see. It would be good to get some input from @pmcpinto and @elizaan36 or @nikkivias on this: would it be ok to show by default the Downloads section, even to stores that don't offer digital goods? If we decide it's better to show it when it's relevant than I think the first option to use a transient would be the way to go, and would improve the current state of things |
Beta Was this translation helpful? Give feedback.
-
Looks like we already display the Additional information block in the editor; which is described as |
Beta Was this translation helpful? Give feedback.
-
I'm unable to see the images in the comments, is there any other way to share them? |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
I agree. Especially considering that stores selling downloadable products are the exception rather than the rule. |
Beta Was this translation helpful? Give feedback.
-
That is the current method of doing things. @wavvves have you looked into moving the transient calculation logic to action scheduler? if transient is set, use it, otherwise it, otherwise, assume the store does have downloadable and show it. |
Beta Was this translation helpful? Give feedback.
-
There are some options to better manage the choice to show or hide this, including that. But I don't think it would be ok that that gets updated regularly and blindly, the merchant might create a downloadable product and there's no guarantee the transient will be updated when he tries to update the template. Since we seem to go the route of keeping the check, maybe the best option would be create it if not existing at first. Then manage it on adding/removing products from catalog. If added virtual set it true, if removed virtual recheck transient (in this case we might use the action scheduler). This would allow to keep the functionality, using only a one-time expensive query , delegating further need to non critical processes via the action scheduler. The template section would be readily available for editing after adding virtual products, on the other hand it would depend on the action scheduler before it disappears from template edition, which is less critical. |
Beta Was this translation helpful? Give feedback.
-
Issue created #47796 Thank you all for your input 🙏 |
Beta Was this translation helpful? Give feedback.
-
Summary: Slow query in
store_has_downloadable_products()
method is affecting performance during template editing and order confirmation.Overview: The method
store_has_downloadable_products()
checks if the store sells downloadable products to determine whether to display the Downloads section during Order Confirmation template editing. However, this method executes a slow query, impacting performance, and runs unnecessarily on every editor call, and with greater severity, during the Place Order flow.Although it uses a transient to store the result, this may become invalid due to changes in product catalog, triggering unnecessary re-evaluation of the slow query.
Proposed Solutions:
Optimize Query Handling: Implement a solution to set the transient once and manage it efficiently upon product creation, deletion, or update.
Alternative Approach: Consider bypassing the check altogether and always displaying the Downloads section during template editing, regardless of current downloadable product offerings. This approach avoids transient management overhead and ensures consistent interface behavior.
The Order Confirmation template can be updated to improve clarity around the Downloads section, making it obvious as a section that may not show after placing an order. Also, the user will always be aware of this element when editing the template.
Before:
After changing the duplicate “Test Product” to “Test Downloadable Product”. Maybe the word “Test” could be removed altogether 🤔:
Thoughts? 💡
Beta Was this translation helpful? Give feedback.
All reactions