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

Release: 10.9.3 #10725

Merged
merged 44 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
c7ea3f2
Empty commit for release pull request
invalid-email-address Aug 17, 2023
45a8074
Fix "On sale" badge class (#10634)
albarin Aug 17, 2023
5153bfa
Remove client side navigation from Products beta block (#10636)
imanish003 Aug 17, 2023
246320b
Update WooCommerce Blocks brand assets (#10622)
tjcafferkey Aug 16, 2023
3a5a2b3
Update testing instructions
nielslange Aug 17, 2023
77e3e33
Update changelog
nielslange Aug 17, 2023
da05e75
Fix version number of testing instructions
nielslange Aug 17, 2023
8fb8287
Update testing notes
nielslange Aug 17, 2023
fc22060
Update testing ZIP file
nielslange Aug 17, 2023
8140b56
Update version number
nielslange Aug 17, 2023
416d5a7
Empty commit for release pull request
invalid-email-address Aug 17, 2023
cee1a98
Load Interactivity API in `bootstrap.php` (#10657)
gigitux Aug 18, 2023
18a20f1
Empty commit for release pull request
invalid-email-address Aug 21, 2023
a5f67f0
Add readme file
imanish003 Aug 21, 2023
4b5a372
Update testing instructions
imanish003 Aug 21, 2023
d5dca9d
Merge branch 'release/10.9.2' of https://github.com/woocommerce/wooco…
imanish003 Aug 21, 2023
2e0e3f8
Change versions
imanish003 Aug 21, 2023
e2a06d2
Update zip
imanish003 Aug 21, 2023
fb8cb32
Update 1092.md
imanish003 Aug 21, 2023
4640c89
Update 1092.md
imanish003 Aug 21, 2023
f68a001
Make View Cart link displayed below the Add to Cart button (#10675)
kmanijak Aug 21, 2023
315b987
Update testing instructions
imanish003 Aug 21, 2023
d6025f8
Update testing notes
nielslange Aug 21, 2023
b351cdf
Fix: Made migration migrate block templates in the current theme (#10…
mikejolley Aug 18, 2023
c68583b
Fix: sync_endpoint_with_page should use a matching slug if it exists …
mikejolley Aug 17, 2023
85f596a
Fix/10530 Inconsistent new install behaviour for templates when using…
wavvves Aug 21, 2023
c783b25
Update ZIP file
nielslange Aug 21, 2023
23dc2e4
Update testing notes
nielslange Aug 21, 2023
58b0ca0
Update testing notes
nielslange Aug 21, 2023
8804488
Update testing notes
nielslange Aug 21, 2023
72be64f
Update testing notes
nielslange Aug 21, 2023
e37a3ec
Update woocommerce.zip file
nielslange Aug 21, 2023
d973534
Revert "Fix: sync_endpoint_with_page should use a matching slug if it…
nielslange Aug 21, 2023
edc68b6
Update testing notes
nielslange Aug 21, 2023
b9f91e1
Update ZIP file
nielslange Aug 21, 2023
8dce24b
Update changelog
nielslange Aug 21, 2023
8a37110
Empty commit for release pull request
invalid-email-address Aug 24, 2023
01b8a21
Add changelog to readme.txt
thealexandrelara Aug 24, 2023
718b325
Update plugin version in several files
thealexandrelara Aug 24, 2023
f266cff
Revert dequeue add-to-cart-variation script which is needed to proper…
kmanijak Aug 24, 2023
bae75a0
Add the testing notes for 10.9.3
thealexandrelara Aug 24, 2023
2b23fe2
Update 1093.md
thealexandrelara Aug 24, 2023
482f5d8
Merge branch 'release/10.9.0' into release/10.9.3
thealexandrelara Aug 24, 2023
2cf8f54
Fix md lint error
thealexandrelara Aug 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .wordpress-org/banner-1544x500.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .wordpress-org/banner-772x250.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .wordpress-org/icon-128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .wordpress-org/icon-256x256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/css/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@
}
}
}
.wc-block-grid__product-image .wc-block-grid__product-onsale,
.wc-block-grid .wc-block-grid__product-onsale {
@include font-size(small);
padding: em($gap-smallest) em($gap-small);
Expand Down
1 change: 1 addition & 0 deletions assets/js/atomic/blocks/product-elements/button/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
white-space: normal;
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
gap: $gap-small;

Expand Down
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": "10.9.0",
"version": "10.9.3",
"keywords": [
"gutenberg",
"woocommerce",
Expand Down
42 changes: 42 additions & 0 deletions docs/internal-developers/testing/releases/1091.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Testing notes and ZIP for release 10.9.1

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

## WooCommerce Core

### Bug Fixes

#### Remove client side navigation from Products beta block. [#10636](https://github.com/woocommerce/woocommerce-blocks/pull/10636)

1. Create a new post
2. Add Products (Beta) block & publish it
3. On Frontend, verify that
1. Client-side navigation isn't there anymore i.e. changing the page should also refresh the page
2. Verify that Product button(Add to cart) still works as expected.

## Testing notes for the development team

### Bug Fixes

1. Checkout to the PR branch and run `npm run start`.
2. Enable a blocks theme (like TT3).
3. Create a new page or post.
4. Add the Products (Beta), Products Collection, Products by Attribute, Products by Tag, Products by Category, Handpicked products, and All products blocks.
5. Check the Sale badge is shown on the top-right corner of the image on all of them, in the editor, and in the frontend.
6. Go to the classic shop page and check the Sale badge also shows in the top-right corner of the product image.
7. Repeat steps 3 to 6 with Storefront enabled.

#### Screenshots

<table>
<tr>
<td valign="top">Before:
<br><br>
<img width="1245" alt="Screenshot 2023-08-17 at 09 57 30" src="https://github.com/woocommerce/woocommerce-blocks/assets/186112/fe1eda4a-549c-4b08-b4aa-34e4a24fbf87">
</td>
<td valign="top">After:
<br><br>
<img width="1248" alt="Screenshot 2023-08-17 at 09 56 36" src="https://github.com/woocommerce/woocommerce-blocks/assets/186112/9b93adbb-c0b9-4134-b6b2-250bd9bbee42">
</td>
</tr>
</table>
74 changes: 74 additions & 0 deletions docs/internal-developers/testing/releases/1092.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Testing notes and ZIP for release 10.9.2

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

## WooCommerce Core

### Bug Fixes

#### Load Interactivity API in `bootstrap.php`. [#10657](https://github.com/woocommerce/woocommerce-blocks/pull/10657)

> **Note**
> Ignore the first step if testing in WooCommerce Core.

1. Install this custom build of WooCommerce that includes this patch: [woocommerce.zip](https://github.com/woocommerce/woocommerce-blocks/files/12397185/woocommerce.zip).
2. Make sure that `WooCommerce Blocks` plugin is not active.
3. Open the Site Editor and ensure that you are using the blockified template on the Product Catalog template.
4. Visit the `/shop` page and ensure that the Product Button(Add to Cart) works as expected.

#### Make View Cart link displayed below the Add to Cart button. [#10675](https://github.com/woocommerce/woocommerce-blocks/pull/10675)

1. Edit Product Catalog template
2. Add Products (Beta) block if it's not there already
3. Save and go to frontend
4. Add a simple product to cart
5. Expected: "View Cart" link appears BELOW the Add to Cart button

<table>
<tr>
<td>Before:
<br><br>
<img width="955" alt="image" src="https://github.com/woocommerce/woocommerce-blocks/assets/20098064/6debf2e7-b529-4c45-828b-9705686f08a3">
</td>
<td>After:
<br><br>
<img width="956" alt="image" src="https://github.com/woocommerce/woocommerce-blocks/assets/20098064/a1b7cb06-0ac0-40d8-b865-5c87977016a8">
</td>
</tr>
</table>

## Should be tested by the development team exclusively

### Bug Fixes

#### Fix: Made migration migrate block templates in the current theme. [#10641](https://github.com/woocommerce/woocommerce-blocks/pull/10641)

1. Install a theme that uses block templates. In my case I used FotaWP.
2. Go to Appearance > Edit > Templates and reset the cart/checkout templates to default.
3. Delete has_migrated_cart and has_migrated_checkout options from your options database.
4. View a page on the store.
5. Confirm by viewing the cart and checkout pages that they inherited the block template from the theme. In this case for instance, instead of the default distraction free template we had, you'll see something like this:

![Screenshot 2023-08-17 at 12 55 00](https://github.com/woocommerce/woocommerce-blocks/assets/90977/bf55ff6c-e8f7-440e-99ed-ec1e676a988b)

#### Fix/10530 Inconsistent new install behaviour for templates when using block themes. [#10608](https://github.com/woocommerce/woocommerce-blocks/pull/10608)

1. Get a new env ready to install WP/WC using WP-CLI. You can use this [quick docker setup](https://github.com/woocommerce/woocommerce-blocks/files/12394720/new-test-env.zip)
2. Alias or copy this branch, built ready to use as a plugin into the env
3. Using WP-CLI set up WC using the following command sequence (alter args to suit your case)

```sh
wp config create --dbname=wordpress --dbuser=wordpress --dbpass=wordpress --dbhost=db --force
wp core install --url=http://localhost --title='WP Staging' --admin_user=admin --admin_password=pass [email protected]
wp option set blog_public 0
wp plugin activate woocommerce-blocks
wp plugin install woocommerce --version=6.0.0
wp plugin activate woocommerce
wp plugin install wordpress-importer --activate
wp import ./wp-content/plugins/woocommerce/sample-data/sample_products.xml --authors=skip
wp plugin update woocommerce
```

4. Visit the store for the first time, head to Appearance > Editor > Templates > Manage all templates verify that Cart and Checkout have customizations saved
5. Open each one and verify they contain the shortcode version
6. Test the complete checkout flow.
33 changes: 33 additions & 0 deletions docs/internal-developers/testing/releases/1093.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Testing notes and ZIP for release 10.9.3

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

## WooCommerce Core

### Bug Fixes

#### Add to Cart: fix the problem that variable products couldn't be added to cart [#10657](https://github.com/woocommerce/woocommerce-blocks/pull/10657)

1. Make sure you're using blockified Single Product template
2. Go to frontend
3. Go to product page for variable product (e.g. Hoodie when using sample products)
4. Choose Color and With Logo
5. Make sure Price appears when you chose the options
6. Add the product to Cart
7. Make sure product is added to cart correctly and there's no error

**Before**

https://github.com/woocommerce/woocommerce-blocks/assets/20469356/7b90f169-263c-4c26-8ee9-70004756d128

**After**

https://github.com/woocommerce/woocommerce-blocks/assets/20469356/51ba5589-83cd-4cd1-8956-b8c59f44ce5b








3 changes: 3 additions & 0 deletions docs/internal-developers/testing/releases/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ Every release includes specific testing instructions for new features and bug fi
- [10.8.2](./1082.md)
- [10.8.3](./1083.md)
- [10.9.0](./1090.md)
- [10.9.1](./1091.md)
- [10.9.2](./1092.md)
- [10.9.3](./1093.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": "10.9.0",
"version": "10.9.3",
"description": "WooCommerce blocks for the Gutenberg editor.",
"homepage": "https://github.com/woocommerce/woocommerce-gutenberg-products-block/",
"keywords": [
Expand Down
30 changes: 28 additions & 2 deletions 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: 10.9.0
Stable tag: 10.9.3
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0.html

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

== Changelog ==

= 10.9/0 - 2023-08-14 =
= 10.9.3 - 2023-08-24 =

#### Bug Fixes

- Add to Cart: fix the problem that variable products couldn't be added to cart

= 10.9.2 - 2023-08-21 =

#### Bug Fixes

- Load Interactivity API in `bootstrap.php`. ([10657](https://github.com/woocommerce/woocommerce-blocks/pull/10657))
- Add to Cart button: fix the layout of View Cart link showing after adding product to cart. ([10675](https://github.com/woocommerce/woocommerce-blocks/pull/10675))
- Fixed checkout and cart page migration routine for users of block themes so that block templates are also migrated. ([10641](https://github.com/woocommerce/woocommerce-blocks/pull/10641))
- Fixed a bug causing Cart and Checkout Blocks to be used by default instead of shortcode versions on WC updates. ([10608](https://github.com/woocommerce/woocommerce-blocks/pull/10608))

= 10.9.1 - 2023-08-17 =

#### Enhancements

- Update WooCommerce Blocks brand assets. ([10622](https://github.com/woocommerce/woocommerce-blocks/pull/10622))

#### Bug Fixes

- Fix "On sale" badge class. ([10634](https://github.com/woocommerce/woocommerce-blocks/pull/10634))
- Remove client side navigation from Products beta block. ([10636](https://github.com/woocommerce/woocommerce-blocks/pull/10636))

= 10.9.0 - 2023-08-14 =

#### Enhancements

Expand Down
115 changes: 9 additions & 106 deletions src/BlockTemplatesController.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
namespace Automattic\WooCommerce\Blocks;

use Automattic\Jetpack\Constants;
use Automattic\WooCommerce\Blocks\Domain\Package;
use Automattic\WooCommerce\Blocks\Templates\CartTemplate;
use Automattic\WooCommerce\Blocks\Templates\CheckoutTemplate;
Expand All @@ -10,6 +11,7 @@
use Automattic\WooCommerce\Blocks\Utils\BlockTemplateUtils;
use Automattic\WooCommerce\Blocks\Templates\OrderConfirmationTemplate;
use Automattic\WooCommerce\Blocks\Utils\SettingsUtils;
use Automattic\WooCommerce\Blocks\Utils\BlockTemplateMigrationUtils;
use \WP_Post;

/**
Expand Down Expand Up @@ -766,117 +768,18 @@ function_exists( 'is_shop' ) &&
* Migrates page content to templates if needed.
*/
public function maybe_migrate_content() {
if ( ! $this->has_migrated_page( 'cart' ) ) {
$this->migrate_page( 'cart', CartTemplate::get_placeholder_page() );
}
if ( ! $this->has_migrated_page( 'checkout' ) ) {
$this->migrate_page( 'checkout', CheckoutTemplate::get_placeholder_page() );
}
}

/**
* Check if a page has been migrated to a template.
*
* @param string $page_id Page ID.
* @return boolean
*/
protected function has_migrated_page( $page_id ) {
return (bool) get_option( 'has_migrated_' . $page_id, false );
}

/**
* Prepare default page template.
*
* @param \WP_Post $page Page object.
* @return string
*/
protected function get_default_migrate_page_template( $page ) {
$default_template_content = $this->get_block_template_part( 'header' );
$default_template_content .= '
<!-- wp:group {"layout":{"inherit":true}} -->
<div class="wp-block-group">
<!-- wp:heading {"level":1} -->
<h1 class="wp-block-heading">' . wp_kses_post( $page->post_title ) . '</h1>
<!-- /wp:heading -->
' . wp_kses_post( $page->post_content ) . '
</div>
<!-- /wp:group -->
';
$default_template_content .= $this->get_block_template_part( 'footer' );

return $default_template_content;
}

/**
* Migrates a page to a template if needed.
*
* @param string $page_id Page ID.
* @param \WP_Post $page Page object.
*/
protected function migrate_page( $page_id, $page ) {
if ( ! $page || empty( $page->post_content ) ) {
update_option( 'has_migrated_' . $page_id, '1' );
// Migration should occur on a normal request to ensure every requirement is met.
// We are postponing it if WP is in maintenance mode, installing, WC installing or if the request is part of a WP-CLI command.
if ( wp_is_maintenance_mode() || ! get_option( 'woocommerce_db_version', false ) || Constants::is_defined( 'WP_SETUP_CONFIG' ) || Constants::is_defined( 'WC_INSTALLING' ) || Constants::is_defined( 'WP_CLI' ) ) {
return;
}

// Use the page template if it exists, which we'll use over our default template if found.
$existing_page_template = BlockTemplateUtils::get_block_template( get_stylesheet() . '//page', 'wp_template' );

if ( $existing_page_template && ! empty( $existing_page_template->content ) && strstr( $existing_page_template->content, 'wp:post-content' ) ) {
// Massage the original content into something we can use. Replace post content with a group block.
$pattern = '/(<!--\s*)wp:post-content(.*?)(\/-->)/';
$replacement = '
<!-- wp:group $2 -->
<div class="wp-block-group">' . wp_kses_post( $page->post_content ) . '</div>
<!-- /wp:group -->
';
$template_content = preg_replace( $pattern, $replacement, $existing_page_template->content );
} else {
$template_content = $this->get_default_migrate_page_template( $page );
}

$new_page_template = BlockTemplateUtils::get_block_template( 'woocommerce/woocommerce//' . $page_id, 'wp_template' );

// Check template validity--template must exist, and custom template must not be present already.
if ( ! $new_page_template || $new_page_template->wp_id ) {
update_option( 'has_migrated_' . $page_id, '1' );
return;
if ( ! BlockTemplateMigrationUtils::has_migrated_page( 'cart' ) ) {
BlockTemplateMigrationUtils::migrate_page( 'cart', CartTemplate::get_placeholder_page() );
}

$new_page_template_id = wp_insert_post(
[
'post_name' => $new_page_template->slug,
'post_type' => 'wp_template',
'post_status' => 'publish',
'tax_input' => array(
'wp_theme' => $new_page_template->theme,
),
'meta_input' => array(
'origin' => $new_page_template->source,
),
'post_content' => $template_content,
],
true
);

if ( ! is_wp_error( $new_page_template_id ) ) {
update_option( 'has_migrated_' . $page_id, '1' );
}
}

/**
* Returns the requested template part.
*
* @param string $part The part to return.
*
* @return string
*/
protected function get_block_template_part( $part ) {
$template_part = BlockTemplateUtils::get_block_template( get_stylesheet() . '//' . $part, 'wp_template_part' );
if ( ! $template_part || empty( $template_part->content ) ) {
return '';
if ( ! BlockTemplateMigrationUtils::has_migrated_page( 'checkout' ) ) {
BlockTemplateMigrationUtils::migrate_page( 'checkout', CheckoutTemplate::get_placeholder_page() );
}
return $template_part->content;
}

/**
Expand Down
Loading