A new patterns Library for WooCommerce #43374
Replies: 5 comments 5 replies
-
Thanks, Patricia, for this investigation! Everything LGTM. Even in a second iteration, do you think we should allow the possibility of changing the endpoint easily for extenders/adopters who want to have a customized set of patterns? |
Beta Was this translation helpful? Give feedback.
-
Thanks @nefeline! Just a small doubt regarding step
If we successfully achieve steps Thanks! |
Beta Was this translation helpful? Give feedback.
-
We will want to be sure to confirm the current policy on wp.org around hosting assets externally. When we initially started working on Patterns, we wanted to host all of the default pattern images as an external resource to keep the plugin package size down. I did some exploration and discovered that it was not allowed. See this (internal) post for context: p6q8Tx-39F-p2. With patterns becoming more prevalent and the fact that the patterns shipped with WP Core use images that are hosted on the wp.org CDN, perhaps this has changed. 🤞 |
Beta Was this translation helpful? Give feedback.
-
This is a very good call-out; as far as I'm aware, this has not changed, and so explicit consent from the user would be required before we could request/download a pattern (or images) in this way. |
Beta Was this translation helpful? Give feedback.
-
Registering here for future reference that we are moving this discussion to #pluginreview channel on .org to gather additional feedback (the outcome of that discussion will be registered here as soon as we have more information). |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
One of the initiatives of the next phase of the Customize Your Store project and its implementation on core involves migrating all WooCommerce patterns to a shared library, ensuring all patterns are served from an external API. This discussion describes in detail the proposed implementation plan, giving an opportunity for folks to share their thoughts and make suggestions.
Why migrate the WooCommerce patterns to a separate library?
The primary goal is to facilitate sharing patterns across multiple different projects. With this migration, we can rely on the dedicated API to fetch WooCommerce patterns and other external curated patterns for usage within our plugin.
Additionally, the size of the WooCommerce plugin will be significantly reduced, considering all images required for patterns will be migrated to this dedicated API.
Implementation plan
The implementation plan can be broken down into 5 steps:
1. Create a new design source site
Create a new design source site.
2. Patterns Registration
Within this newly created site, create one post for each one of the patterns we have on WooCommerce.
3. Ensure the migrated patterns are accessible via API
In this case, we can either create a new API Service from scratch or rely on a pre-existing one for this purpose, ensuring it's possible to fetch each one of the patterns from the site you created via API.
4. Ensure the migrated patterns are displayed in the editor preview and can be inserted
Ensure WooCommerce patterns are fetched via API, registered, and available in the editor preview and inserter the same way they used to be when patterns were still living within the WooCommerce plugin. To help with this implementation, the following PR on Jetpack can be used as an example of how to achieve this quickly:
https://github.com/Automattic/jetpack/pull/34162/files
5. Enable support for content substitution for AI-generated content
Use Template Substitution to replace the default content in patterns with AI-generated content. This implementation can be made as follows:
This code should live within the
plugins/woocommerce/src/Blocks/AIContent
directory.Text Substitution
plugins/woocommerce/src/Blocks/AIContent/dictionary.json
)Images Substitution
Conclusion
That's a wrap! Looking forward to hearing folks' opinions regarding the proposed implementation, especially @nerrad , @danielwrobert , @albarin , @gigitux
Beta Was this translation helpful? Give feedback.
All reactions