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

Legacy template block: themes can't override the archive-product.html only #5230

Closed
MaggieCabrera opened this issue Nov 24, 2021 · 3 comments · Fixed by #5380
Closed

Legacy template block: themes can't override the archive-product.html only #5230

MaggieCabrera opened this issue Nov 24, 2021 · 3 comments · Fixed by #5380
Assignees
Labels
focus: FSE Work related to prepare WooCommerce for FSE. focus: template Related to API powering block template functionality in the Site Editor type: bug The issue/PR concerns a confirmed bug.
Milestone

Comments

@MaggieCabrera
Copy link

Describe the bug

It seems like a theme can only override the archive product template by overriding the taxonomy category/tag templates.

To reproduce

Steps to reproduce the behavior:

  1. Install Blockbase
  2. Create a template inside block-templates/archive-product.html with this content:
<!-- wp:template-part {"slug":"header","tagName":"header"} /-->

<!-- wp:group {"tagName":"main","layout":{"inherit":true}} -->
<main class="wp-block-group">

	<!-- wp:group {"align":"wide"} -->
	<div class="wp-block-group alignwide">
		<!-- wp:woocommerce/legacy-template {"template":"archive-product"} /-->
	</div>
	<!-- /wp:group -->

</main>
<!-- /wp:group -->

<!-- wp:template-part {"slug":"footer","tagName":"footer","layout":{"inherit":true},"className":"site-footer-container"} /-->
  1. Go to the frontend and check an archive page, it's loading either taxonomy-product_cat.html or taxonomy-product_tag.html from the plugin instead of the theme template we just created (the one we created is wide aligned).

Expected behavior

I expected archive-product.html being defined in the theme to override the more specific templates from the plugin

Environment

WordPress (please complete the following information):

  • Core version: 5.8.2
  • Gutenberg version (if installed): trunk
  • WooCommerce version: 6.1.0
  • WooCommerce Blocks version: 6.5.0
@MaggieCabrera MaggieCabrera added the type: bug The issue/PR concerns a confirmed bug. label Nov 24, 2021
@frontdevde frontdevde added focus: FSE Work related to prepare WooCommerce for FSE. focus: template Related to API powering block template functionality in the Site Editor labels Nov 24, 2021
@Aljullu Aljullu added this to the 6.5.1 milestone Dec 9, 2021
@tjcafferkey tjcafferkey self-assigned this Dec 10, 2021
@tjcafferkey
Copy link
Contributor

tjcafferkey commented Dec 10, 2021

@MaggieCabrera I'm unable to replicate this issue, I've added added the archive-product.html template to the Blockbase theme and added some additional text to the markup you provided, which does get rendered on the frontend by overriding the Woo plugin templates. Can you please confirm if you're still experiencing this issue, or if I have misunderstood the problem?

Just for context, it is here where we check if the theme has a archive-product.html template before rendering our own.

@MaggieCabrera
Copy link
Author

@tjcafferkey it's still happening to me. I'm using this branch of Blockbase that has the edited templates (basically I make them wide width). Using the following plugins:

Screenshot 2021-12-10 at 11 25 33

After I updated to 6.5.0 and I get the same thing. I do see the code that you are referencing on the plugin, though, so I don't know if I'm doing something else wrong!

This is what I see, the product page gets the wide alignment correctly but not the archive page:

Screen Capture on 2021-12-10 at 11-24-53

@MaggieCabrera
Copy link
Author

Thank you @tjcafferkey! This fixes the issue I had on Blockbase

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
focus: FSE Work related to prepare WooCommerce for FSE. focus: template Related to API powering block template functionality in the Site Editor type: bug The issue/PR concerns a confirmed bug.
Projects
None yet
4 participants