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

Blockified Single Product Template: Show upsells. #9636

Merged
merged 1 commit into from May 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions assets/css/style.scss
Expand Up @@ -336,3 +336,8 @@
.screen-reader-text:focus {
@include visually-hidden-focus-reveal();
}


.wp-block-group.woocommerce.product .up-sells.upsells.products {
max-width: var(--wp--style--global--wide-size);
}
5 changes: 3 additions & 2 deletions src/Templates/SingleProductTemplateCompatibility.php
Expand Up @@ -241,10 +241,11 @@ protected function set_hook_data() {
),
'woocommerce_after_single_product_summary' => array(
'block_name' => 'woocommerce/product-details',
'position' => 'before',
'position' => 'after',
'hooked' => array(
'woocommerce_output_product_data_tabs' => 10,
'woocommerce_upsell_display' => 15,
// We want to display the upsell products after the last block that belongs to the Single Product.
// 'woocommerce_upsell_display' => 15.
Copy link
Member

Choose a reason for hiding this comment

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

This tested nicely however it seems very counterintuitive that commenting out the woocommerce_upsell_display is the solution to display upsells. Can you explain this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This PR restores the action that renders the grid that includes the upsell products.

The Compatibility Layer removes the default callbacks added to hooks by WooCommerce. This is necessary to avoid duplicate content (since that with the blockified templates, blocks render the HTML). As discussed in #9610, it could not sense that the merchant should see/add a block for product customization on the Single Product Template (a generic template). Since that, we want to enable the blockified templates in the next release, I think that enabling the default callbacks that render the upsells, is a good approach, at least for now.

'woocommerce_output_related_products' => 20,
),
),
Expand Down