Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attach WooCommerce templates to the theme #46831

Draft
wants to merge 13 commits into
base: trunk
Choose a base branch
from

Conversation

Aljullu
Copy link
Contributor

@Aljullu Aljullu commented Apr 23, 2024

Changes proposed in this Pull Request:

Closes #42181.

This PR changes some of the logic of the templates introduced by WooCommerce so instead of being plugin templates they are considered regular theme templates. This makes that when the user switches themes, the templates aren't carried over, fixing #42181.

At the same time, it brings the regression that the theme name is shown as the author of the templates, instead of WooCommerce. Fixing this will likely require changes upstream.

Todo list:

  • Make it so WooCommerce templates are not carried-over when switching themes.
  • Update existing tests.
    • Fix template-customization.block_theme_with_templates.spec.ts tests.
  • Update slugs test to test woocommerce/woocommerce slug as well.
  • (Might be impossible) investigate if it's possible to keep 'WooCommerce' as the visible author of the templates.

How to test the changes in this Pull Request:

  1. With TT4 make some edits to WooCommerce templates.
  2. Go to the frontend and verify the edits were applied correctly.
  3. Switch to TT3.
  4. Verify the edits you did to WooCommerce templates in step 1 are no longer visible, neither in the editor nor the frontend.
  5. Switch back to TT4.
  6. Verify the edits you did to WooCommerce templates in step 1 are visible as expected, in the editor and the frontend.

Changelog entry

  • Automatically create a changelog entry from the details below.

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement - Improvement to existing functionality

Message

Comment

@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Apr 23, 2024
@Aljullu Aljullu force-pushed the fix/42181-attach-woocommerce-templates-to-theme branch 3 times, most recently from 4f2b40e to e9a4bd2 Compare April 25, 2024 09:41
// then we will load in the archive-product.html template from the theme to use for product taxonomies on the frontend.
$template_is_from_theme = 'theme' === $template_file->source;
$theme_name = wp_get_theme()->get( 'TextDomain' );
$theme_name = get_stylesheet();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Aljullu Aljullu force-pushed the fix/42181-attach-woocommerce-templates-to-theme branch 2 times, most recently from a42f5b2 to 91b1a7a Compare April 25, 2024 11:51
@Aljullu Aljullu force-pushed the fix/42181-attach-woocommerce-templates-to-theme branch from 91b1a7a to 74738d8 Compare April 25, 2024 13:58
@Aljullu Aljullu self-assigned this Apr 25, 2024
@Aljullu Aljullu changed the base branch from trunk to fix/template-slugs-variable April 25, 2024 14:43
@Aljullu Aljullu changed the base branch from fix/template-slugs-variable to trunk April 25, 2024 14:43
@Aljullu Aljullu force-pushed the fix/42181-attach-woocommerce-templates-to-theme branch 2 times, most recently from 80e3db6 to 229e732 Compare May 2, 2024 09:42
@Aljullu Aljullu force-pushed the fix/42181-attach-woocommerce-templates-to-theme branch from 229e732 to 86df823 Compare May 2, 2024 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: woocommerce Issues related to the WooCommerce Core plugin.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Header template-part disappears from template after theme change
1 participant