Issues with new (WC8) Cart and Checkout block templates #44937
Replies: 0 comments 3 replies
-
I agree, I find it annoying that WooCommerce templates do not adhere to the default template heirarchy templates I have defined within my theme |
Beta Was this translation helpful? Give feedback.
-
In my theme I have a When I rename templates to So, now, my existing theme users have broken Cart and Checkout templates (as it currently is in my theme - the Checkout template is even missing the header template part). Is there perhaps a way to solve it by making aliases for cart.html / page-cart.html and checkout.html / page-checkout.html? |
Beta Was this translation helpful? Give feedback.
-
hy iu also have same issue how we can edit cart and checkout page with same like old method where we can easily customize with cart.php or formcheckout.php but now it show wc-block I can make it work in custom code ? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I'm really confused about introducing the Cart and Checkout templates for block themes. I don't seem to find benefits of these templates.
Can you please provide info why this new approach was introduced? What are the benefits of having these templates in comparison to pages (pre-WC8 approach)?
Reacting to @ralucaStan feedback, here is my opinion:
I can see these issues with Cart and Checkout templates:
Misused theme template hierarchy?
Templates in WordPress are meant to display multiple occurrences of a similar type of content. For example, the
single.html
template displays single posts and custom post types,archive.html
template displays archives,404.html
template displays whenever a URL is not found (error 404),single-product.html
template displays content of product page.These follow WP template hierarchy very well. All of these mean a single template file displays multiple occurrences of a specific content.
However, the new WC8 Cart and Checkout templates do not seem to follow the same logic - they simply display a content of pages that occur just once. They behave like pages, not like templates.
Misused benefits of site editing?
If a user wants to control entire Cart/Checkout page layout including the site header and footer (benefits of site editing), user can simply create a custom template and use that custom template for their Cart/Checkout page. This is what custom templates are for and there is no need for a theme level Cart/Checkout template here.
Why not to use Cart/Checkout block directly in the page content?
If the Cart and Checkout templates are only to display a specific
woocommerce/cart
andwoocommerce/checkout
blocks, why not to have these blocks inserted directly into the "Cart" and "Checkout" page content? Basically the same approach used with classic themes (or pre-WC8) but instead of shortcodes we can now use blocks:woocommerce/cart
block into the page content. (Instead of a classic content with a shortcode.)Doesn't it work this way? Why a theme level template is required for this approach?
Shouldn't new WC blocks and templates replace the old PHP templates?
If I understand correctly, the new block templates in WooCommerce are meant to replace old PHP templates content with blocks and thus allow users more control without coding. That's perfectly fine and I am very happy about this approach.
But the Cart and Checkout templates seems odd here. I can't find their PHP template equivalent.
I've also created some issues regarding Cart and Checkout templates: #10654, #10642 and #10643
Beta Was this translation helpful? Give feedback.
All reactions