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

Commit

Permalink
Release: 11.1.3 (#11680)
Browse files Browse the repository at this point in the history
* Fix Single Product Classic Template block not showing on the front-end (#11455)

In WordPress 6.4, it appears that the global `have_posts` is `false` in
the context of the full site editing single product template. This
breaks the Classic Template block.

In this commit, we are creating a custom query using the available id
instead of relying on the global query.

This might be a temporary workaround as we are waiting to see
if that's an issue that core is willing to fix, as it might affect
backwards-compatibility for other vendors.

* Empty commit for release pull request

* update testing instructions

* bump version

* add zip link

---------

Co-authored-by: Lucio Giannotta <[email protected]>
Co-authored-by: github-actions <[email protected]>
Co-authored-by: Luigi <[email protected]>
  • Loading branch information
4 people authored Nov 8, 2023
1 parent 1c17b88 commit a6127a0
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 9 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "WooCommerce blocks for the Gutenberg editor.",
"homepage": "https://woocommerce.com/",
"type": "wordpress-plugin",
"version": "11.1.2",
"version": "11.1.3",
"keywords": [
"gutenberg",
"woocommerce",
Expand Down
16 changes: 16 additions & 0 deletions docs/internal-developers/testing/releases/1113.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Testing notes and ZIP for release 11.1.3

Zip file for testing: [woocommerce-gutenberg-products-block.zip](https://github.com/woocommerce/woocommerce-blocks/files/13296296/woocommerce-gutenberg-products-block.zip)

## WooCommerce Core

### Bug Fixes

#### Fix Single Product Classic Template block not showing on the front-end. [11455](https://github.com/woocommerce/woocommerce-blocks/pull/11455)

1. Enable WordPress 6.4.
2. Enable a block theme.
3. Go to Site Editor → Single Product template.
4. Remove the blockified template and add the “Classic Template” block.
5. Save and check the front-end.
6. Check that the template is correctly rendered on the front-end.
1 change: 1 addition & 0 deletions docs/internal-developers/testing/releases/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ Every release includes specific testing instructions for new features and bug fi
- [11.1.0](./1110.md)
- [11.1.1](./1111.md)
- [11.1.2](./1112.md)
- [11.1.3](./1113.md)


<!-- FEEDBACK -->
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@woocommerce/block-library",
"title": "WooCommerce Blocks",
"author": "Automattic",
"version": "11.1.2",
"version": "11.1.3",
"description": "WooCommerce blocks for the Gutenberg editor.",
"homepage": "https://github.com/woocommerce/woocommerce-gutenberg-products-block/",
"keywords": [
Expand Down
8 changes: 7 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: gutenberg, woocommerce, woo commerce, products, blocks, woocommerce blocks
Requires at least: 6.3
Tested up to: 6.3
Requires PHP: 7.3
Stable tag: 11.1.2
Stable tag: 11.1.3
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -81,6 +81,12 @@ Release and roadmap notes available on the [WooCommerce Developers Blog](https:/

== Changelog ==

= 11.1.3 - 2023-11-08 =

#### Bug Fixes

- WordPress 6.4: fixed a bug which would break sites using the Classic Template block for the Single Product template. [11455](https://github.com/woocommerce/woocommerce-blocks/pull/11455)

= 11.1.2 - 2023-09-27 =

#### Bug Fixes
Expand Down
11 changes: 9 additions & 2 deletions src/BlockTypes/ClassicTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,16 @@ protected function render_single_product() {
*/
do_action( 'woocommerce_before_main_content' );

while ( have_posts() ) :
$product_query = new \WP_Query(
array(
'post_type' => 'product',
'p' => get_the_ID(),
)
);

while ( $product_query->have_posts() ) :

the_post();
$product_query->the_post();
wc_get_template_part( 'content', 'single-product' );

endwhile;
Expand Down
2 changes: 1 addition & 1 deletion src/Package.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public static function container( $reset = false ) {
NewPackage::class,
function ( $container ) {
// leave for automated version bumping.
$version = '11.1.2';
$version = '11.1.3';
return new NewPackage(
$version,
dirname( __DIR__ ),
Expand Down
2 changes: 1 addition & 1 deletion woocommerce-gutenberg-products-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: WooCommerce Blocks
* Plugin URI: https://github.com/woocommerce/woocommerce-gutenberg-products-block
* Description: WooCommerce blocks for the Gutenberg editor.
* Version: 11.1.2
* Version: 11.1.3
* Author: Automattic
* Author URI: https://woocommerce.com
* Text Domain: woo-gutenberg-products-block
Expand Down

0 comments on commit a6127a0

Please sign in to comment.