Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Store Customization > Schedule an action to update the wc_blocks_patterns_content option #11166

Closed
Tracked by #11086
nefeline opened this issue Oct 6, 2023 · 0 comments · Fixed by #11210
Closed
Tracked by #11086
Assignees
Labels
focus: patterns WooCommerce patterns type: bug The issue/PR concerns a confirmed bug.

Comments

@nefeline
Copy link
Contributor

nefeline commented Oct 6, 2023

We need to ensure that an action is scheduled on plugin update to ensure the AI-generated content in patterns is updated within the 'wc_blocks_patterns_content' option, ensuring it is always in sync with the default content within the patterns dictionary.

Details

With this change we can avoid the following problem:

  • User updated the content in patterns using AI: now all content is fetched from the 'wc_blocks_patterns_content' option.
  • We change one of our patterns and add a new title to it in the patterns dictionary (in the dictionary.json file) & update the reference on the pattern itself.
  • User with AI-generated content updates the Woo Blocks plugin and is now immediately greeted with a PHP warning of undefined index since AI content was never generated for the newly introduced title in the pattern (the DB is not in sync with the patterns dictionary).

Complementing this change, we also have to update all patterns to ensure they have an empty fallback and prevent the warning in case something prevents the scheduled action from running (we can adopt an approach similar to what was made on #11158 ).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
focus: patterns WooCommerce patterns type: bug The issue/PR concerns a confirmed bug.
Projects
None yet
2 participants