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

Provide a way to switch to the blockified Single Product Template #8324

Merged
merged 197 commits into from
Mar 23, 2023
Merged
Show file tree
Hide file tree
Changes from 196 commits
Commits
Show all changes
197 commits
Select commit Hold shift + click to select a range
d46e480
Add minimum structure for Single Product Details block
thealexandrelara Jan 17, 2023
38fcacb
Add Product Image Gallery #8233
gigitux Jan 18, 2023
2fddc21
First try to render Product Arhcive template as blocks
kmanijak Jan 20, 2023
d5eb4e3
First iteration of the whole blockified product archive template
kmanijak Jan 20, 2023
2a1b52c
Merge branch 'trunk' of https://github.com/woocommerce/woocommerce-bl…
gigitux Jan 20, 2023
e743ebe
Add tests for Single Product Details block
thealexandrelara Jan 20, 2023
5f95c8d
Extract a blockified Product Archive Template to the templates
kmanijak Jan 21, 2023
7b94fc5
Add templates to tsconfig.json so the files are resolved as part of t…
kmanijak Jan 21, 2023
a5b2a79
Add a encouragement note to use blockified version IF migration is av…
kmanijak Jan 21, 2023
c3bbc70
Add a Row block wrapping Product Results Count and Catalog Sorting bl…
kmanijak Jan 24, 2023
a185597
Move blockified product-archive from templates/ to assets/ directory
kmanijak Jan 24, 2023
e9dee03
Remove unnecessary margin from Product Results Count block
kmanijak Jan 24, 2023
6e49f88
Fix TypeScript error
kmanijak Jan 24, 2023
e6922a9
Update the description of the Classic Template Editor placeholder
kmanijak Jan 24, 2023
012a03f
Remove unnecessary entry in tsconfig.json to include templates directory
kmanijak Jan 24, 2023
12d4c62
Move the to
kmanijak Jan 24, 2023
52d1313
Differentiate the Classic Template placeholder description depending …
kmanijak Jan 24, 2023
3a050d3
Add the initial basis for the Add to Cart button
nefeline Jan 24, 2023
a52107d
Add E2E test that the Classic Template can be replaced with the block…
kmanijak Jan 24, 2023
b57cc98
Abandon writing E2E tests for now, as there's a problem to run them l…
kmanijak Jan 25, 2023
610eeda
Merge branch 'trunk' into add/convert-classic-template
kmanijak Jan 25, 2023
f096dc9
Trigger the single product add to cart action for each product type.
nefeline Jan 25, 2023
a203496
Syntax improvement
kmanijak Jan 25, 2023
b603490
Set margin for Catalog Sorting to 0, so it aligns properly when used …
kmanijak Jan 25, 2023
847fb46
Make the blockification config, so it covers the Product Archive as w…
kmanijak Jan 25, 2023
c812ba5
Merge branch 'add/convert-classic-template' of github.com:woocommerce…
kmanijak Jan 25, 2023
bda27ac
Move the product-archive specific functions from classic-template/ind…
kmanijak Jan 25, 2023
f87de21
wip: create block structure and add initial styles
thealexandrelara Jan 25, 2023
88ddb2a
Add alignment option to the Store Notices block and make the blockifi…
kmanijak Jan 26, 2023
7427a4b
Merge branch 'trunk' into add/convert-classic-template
kmanijak Jan 26, 2023
a64835e
Create single-product.ts file which is a placeholder for the blockifi…
kmanijak Jan 26, 2023
561f6f8
Add block details to the SingleProductDetails.php file
thealexandrelara Jan 26, 2023
36f740b
Make Blockified Product Archive template inherit the align attibute
kmanijak Jan 27, 2023
c2c5657
Simplify the interface of blockified templates
kmanijak Jan 27, 2023
9b0fd88
Merge branch 'trunk' into add/add-to-cart-block
nefeline Jan 27, 2023
7f1d2eb
Add a BlockifiedTemplate type
kmanijak Jan 27, 2023
4a4b8e5
Rename and simplify the function checking if conversion of classic te…
kmanijak Jan 27, 2023
f14f657
Merge branch 'add/convert-classic-template' of github.com:woocommerce…
kmanijak Jan 27, 2023
1331e1c
Rename the block from add-to-cart-button to add-to-cart-form
nefeline Jan 27, 2023
a65d69d
Update to use the cart icon.
nefeline Jan 27, 2023
5505f02
Align the variable naming to use instead of
kmanijak Jan 27, 2023
16ee8bf
Implement the skeleton for the editor preview.
nefeline Jan 27, 2023
d07b9b5
Render tabs title with empty content
thealexandrelara Jan 27, 2023
9c90f71
Use woocommerce_output_product_data_tabs function to retrieve tabs data
thealexandrelara Jan 27, 2023
eb6301b
Merge branch 'trunk' into add/add-to-cart-block
nefeline Jan 29, 2023
961b62f
Update styles and add Notice for the display in the Editor.
nefeline Jan 29, 2023
01a6400
Update CSS.
nefeline Jan 29, 2023
5f889e6
Merge branch 'trunk' of https://github.com/woocommerce/woocommerce-bl…
gigitux Jan 30, 2023
caa6e6a
Add base tests for the new Add to Cart Form component.
nefeline Jan 30, 2023
13dc046
Add Product Image Gallery block
gigitux Jan 30, 2023
1dc7baa
Merge branch 'trunk' of https://github.com/woocommerce/woocommerce-bl…
gigitux Jan 30, 2023
6d8607c
Pass the Classic Template attributes to the blockified template inste…
kmanijak Jan 30, 2023
3afd81e
Merge branch 'trunk' into add/convert-classic-template
kmanijak Jan 30, 2023
a3b50bd
Include Breadcrumbs block in the Blockified Product Archive Template
kmanijak Jan 30, 2023
435b7f4
Consume alignment attributes of Catalog Sorting in the PHP render fun…
kmanijak Jan 30, 2023
8a36881
Consume alignment attributes of Breadcrumbs in the PHP render function
kmanijak Jan 30, 2023
61fd14a
Show conversion button with label and description
albarin Jan 30, 2023
fb03d21
Add conversion placeholder (until we have all the blocks implemented)
albarin Jan 30, 2023
11c587a
Remove align support from Catalog Sorting and add to Store Notices block
kmanijak Jan 30, 2023
21a1fea
remove support global styles
gigitux Jan 30, 2023
d9900e0
remove support global styles
gigitux Jan 30, 2023
75d00bb
Merge branch 'add/8233-product-image-gallery-block' of https://github…
gigitux Jan 30, 2023
f8e00c9
Merge branch 'trunk' into add/8233-product-image-gallery-block
gigitux Jan 30, 2023
3c06189
Update the button CSS.
nefeline Jan 30, 2023
eb0ce4a
Remove customizations for the Single Product Details block
thealexandrelara Jan 30, 2023
30f3385
Update styles for the cart form.
nefeline Jan 30, 2023
8a58e3c
update td style.
nefeline Jan 30, 2023
22be4e9
Merge branch 'trunk' into feat/add-single-product-details-block
thealexandrelara Jan 30, 2023
d57a5da
Update divs and CSS.
nefeline Jan 30, 2023
c394df5
Merge branch 'trunk' into add/add-to-cart-block
nefeline Jan 30, 2023
137776a
Use conventional input instead of the experimental InputControl
nefeline Jan 30, 2023
d3d2826
Merge branch 'add/convert-classic-template' into add/8208-convert-sin…
albarin Jan 31, 2023
cd71a6a
Extend the get_classes_and_styles_by_attributes method with align and…
kmanijak Jan 31, 2023
795a698
address CSS feedback
gigitux Jan 31, 2023
90c71d3
Merge branch 'add/8233-product-image-gallery-block' of https://github…
gigitux Jan 31, 2023
fe5f1a8
Add Archive Title block to the Blockified Classic Template
kmanijak Jan 31, 2023
adcec0b
Minor getRowBlock function refactor
kmanijak Jan 31, 2023
e16cbc8
Merge branch 'add/convert-classic-template' into add/8208-convert-sin…
albarin Jan 31, 2023
dc48ddf
add support for the custom classname
gigitux Jan 31, 2023
e526eff
remove save function
gigitux Jan 31, 2023
31a5d4e
Add property to the classic templates and base the config on it inst…
kmanijak Jan 31, 2023
9e2d999
Add separate blockified template for a Product Search Results
kmanijak Jan 31, 2023
295e601
Pass attribute from classic template to No Results block in Product …
kmanijak Jan 31, 2023
2a4baad
Remove unnecessary console.log from the Edit.tsx file
thealexandrelara Jan 31, 2023
8e05b71
Remove block classname from block wrapper
thealexandrelara Jan 31, 2023
f70ab0c
Remove unnecessary WooCommerce tabs filter from the BlockTemplatesCon…
thealexandrelara Jan 31, 2023
4ea37cb
Merge branch 'trunk' into feat/add-single-product-details-block
thealexandrelara Jan 31, 2023
ad70695
Remove attributes property from the block registration
thealexandrelara Jan 31, 2023
fd83c09
Remove isExperimental flag for the Single Product Details block
thealexandrelara Jan 31, 2023
3661133
Remove get_classes_and_styles_by_attributes method from SingleProduct…
thealexandrelara Jan 31, 2023
8a9196e
Prevent Single Product Details block from apppearing in Pages or Posts
thealexandrelara Jan 31, 2023
18dea27
Extract the common functions between blockified archive-template and …
kmanijak Feb 1, 2023
39e6c73
Enable 'Inherit query from template' in Products block by default whe…
kmanijak Feb 1, 2023
713cc5e
Merge branch 'trunk' into add/convert-classic-template
kmanijak Feb 1, 2023
66595f1
add second parameter to the subscribe function
gigitux Feb 1, 2023
5a0eb23
Implement the new design and copy provided for the editor.
nefeline Feb 1, 2023
dbc8f4b
Make the notice compatible with dark themes.
nefeline Feb 1, 2023
9a5b468
Some additional CSS tweaks
nefeline Feb 1, 2023
e196c6a
adjust the padding for the input
nefeline Feb 1, 2023
deaf86e
wrap the Single Product Template in a div with the product class
gigitux Feb 1, 2023
edcac21
Fix PHP Coding Standards warnings
thealexandrelara Feb 1, 2023
1722726
Improve the naming of BlockifiedTemplateConfig type
kmanijak Feb 2, 2023
11a90df
Differentiate Product Catalog and Products By * templates. The latter…
kmanijak Feb 2, 2023
35c8dc1
Merge branch 'add/convert-classic-template' of github.com:woocommerce…
kmanijak Feb 2, 2023
95a05a4
improve logic and increase coverage of unit test
gigitux Feb 2, 2023
83e8088
Merge branch 'trunk' into add/add-to-cart-block
nefeline Feb 2, 2023
7f6a438
Change unclear ProductsBy to ProductTaxonomy in regards to classic te…
kmanijak Feb 3, 2023
1568ec2
improve logic and increase coverage of unit test
gigitux Feb 3, 2023
379548a
Merge branch 'trunk' into fix/8314-blockifying-single-product-templat…
gigitux Feb 3, 2023
e82ab27
fix test
gigitux Feb 3, 2023
36d5ebf
format HTML
gigitux Feb 3, 2023
4e76b07
fix edge case
gigitux Feb 3, 2023
c701d7f
Merge branch 'trunk' of https://github.com/woocommerce/woocommerce-bl…
gigitux Feb 3, 2023
5a4ac3b
Merge branch 'trunk' of https://github.com/woocommerce/woocommerce-bl…
gigitux Feb 13, 2023
8aee841
update @types/wordpress__data package
gigitux Feb 13, 2023
32f97dd
update placeholder, icon and description
gigitux Feb 13, 2023
e3be328
update tsconfig
gigitux Feb 13, 2023
528b9ce
Merge branch 'trunk' into feat/add-single-product-details-block
gigitux Feb 13, 2023
0ba35e1
update block name
gigitux Feb 13, 2023
af09b77
Merge branch 'feat/add-single-product-details-block' of https://githu…
gigitux Feb 13, 2023
93bcb28
fix SCSS linter error
gigitux Feb 13, 2023
f48dad5
Merge branch 'add/add-to-cart-block' of https://github.com/woocommerc…
gigitux Feb 13, 2023
03a909c
Merge branch 'add/8233-product-image-gallery-block' into add/compatib…
gigitux Feb 13, 2023
4b5e9c2
Merge branch 'feat/add-single-product-details-block' into add/compati…
gigitux Feb 13, 2023
82184a0
Merge branch 'trunk' of https://github.com/woocommerce/woocommerce-bl…
gigitux Feb 14, 2023
6413df8
address feedback
gigitux Feb 14, 2023
c8cd88e
Merge branch 'trunk' of https://github.com/woocommerce/woocommerce-bl…
gigitux Feb 14, 2023
3478a2e
Merge branch 'fix/8314-blockifying-single-product-template-investigat…
gigitux Feb 14, 2023
5a8c13f
create SingleProductTemplateCompatibility class
gigitux Feb 14, 2023
3ba2516
Revert the margin fix which was added already on trunk
kmanijak Feb 14, 2023
5819006
Merge branch 'trunk' into add/convert-classic-template
kmanijak Feb 14, 2023
51f6e06
Merge branch 'trunk' of https://github.com/woocommerce/woocommerce-bl…
gigitux Feb 14, 2023
8aa45a2
Merge branch 'add/convert-classic-template' into add/8208-convert-sin…
albarin Feb 15, 2023
94ac4a0
Add Hooks compatibility
gigitux Feb 14, 2023
78f0b87
Merge branch 'trunk' of https://github.com/woocommerce/woocommerce-bl…
gigitux Feb 15, 2023
607dff4
remove not used file
gigitux Feb 15, 2023
2df42bd
Merge branch 'trunk' of https://github.com/woocommerce/woocommerce-bl…
gigitux Feb 16, 2023
2a0848f
remove not used files
gigitux Feb 16, 2023
d715fa3
Add compatibility layer for the Single Product template
gigitux Feb 16, 2023
ce9bd9c
Merge branch 'trunk' of https://github.com/woocommerce/woocommerce-bl…
gigitux Feb 16, 2023
eeef013
Merge branch 'add/compatibility-single-product-block' into 8465-singl…
gigitux Feb 17, 2023
6996ca8
fix check
gigitux Feb 17, 2023
ecebc81
Merge branch 'add/compatibility-single-product-block' into 8465-singl…
gigitux Feb 17, 2023
7790a5d
implement Product meta template header
gigitux Feb 20, 2023
d4f417c
Add default Single Product HTML template
thealexandrelara Feb 22, 2023
a5d8124
Fix style issues when adding blocks inside group/stack/columns blocks
thealexandrelara Feb 22, 2023
6720f96
Merge branch 'trunk' into feat/add-default-single-product-html-template
thealexandrelara Feb 23, 2023
4690ee5
Merge branch 'trunk' into feat/add-default-single-product-html-template
thealexandrelara Feb 24, 2023
9f167f5
Add Related Products to the default single product template HTML file
thealexandrelara Feb 24, 2023
846b803
Merge branch 'trunk' of https://github.com/woocommerce/woocommerce-bl…
gigitux Mar 1, 2023
f16d440
Merge branch 'trunk' into 8465-single-product-template-create-a-templ…
gigitux Mar 2, 2023
5205f52
Product Price Block: Add support Single Product Template
gigitux Mar 2, 2023
32c7203
Merge branch 'trunk' of https://github.com/woocommerce/woocommerce-bl…
gigitux Mar 3, 2023
a3d1ba3
fix missing import
gigitux Mar 3, 2023
a3c3673
add comment
gigitux Mar 3, 2023
8ccb2b3
return a value
gigitux Mar 3, 2023
9d8a43a
improve comment
gigitux Mar 3, 2023
5b47d97
fix import
gigitux Mar 3, 2023
851861a
Merge branch '8479-product-price-block-add-support-to-the-single-prod…
gigitux Mar 3, 2023
4c8f30d
Add Product Meta block
gigitux Mar 3, 2023
4789141
Merge branch 'trunk' into 8465-single-product-template-create-a-templ…
gigitux Mar 3, 2023
1845743
Merge branch 'trunk' of https://github.com/woocommerce/woocommerce-bl…
gigitux Mar 3, 2023
b15a736
Merge branch '8465-single-product-template-create-a-template-part-cal…
gigitux Mar 3, 2023
cfd96f4
Merge branch 'trunk' into feat/add-default-single-product-html-template
thealexandrelara Mar 3, 2023
02de1a6
wrap up default single product html
gigitux Mar 3, 2023
fb8e80c
Merge branch 'trunk' of https://github.com/woocommerce/woocommerce-bl…
gigitux Mar 8, 2023
6783fb4
Merge branch 'feat/wrap-up-default-single-product-html-template' of h…
gigitux Mar 8, 2023
b3eb497
remove classname
gigitux Mar 8, 2023
a0752f7
Merge branch 'feat/wrap-up-default-single-product-html-template' of h…
gigitux Mar 8, 2023
feac94f
add blocks
gigitux Mar 8, 2023
5ccebae
Merge branch 'trunk' of https://github.com/woocommerce/woocommerce-bl…
gigitux Mar 9, 2023
c94b7b9
improve code
gigitux Mar 9, 2023
35ff36f
Remove !important statement from Product Image Gallery block css
thealexandrelara Mar 11, 2023
76b112c
Change width of Product Image Gallery block to initial instead of unset
thealexandrelara Mar 11, 2023
52c1ed4
Merge branch 'trunk' into add/8208-convert-single-product
gigitux Mar 13, 2023
b8e7bd0
Merge branch 'trunk' of https://github.com/woocommerce/woocommerce-bl…
gigitux Mar 20, 2023
66afe60
Merge branch 'trunk' of https://github.com/woocommerce/woocommerce-bl…
gigitux Mar 21, 2023
ae3d39f
Wrap up default single product html template (#8632)
gigitux Mar 21, 2023
4029fcf
Fix images width in the Single Product page
thealexandrelara Mar 21, 2023
ebda787
Remove the !important attribute from the Product Image Gallery block
thealexandrelara Mar 21, 2023
dc8e855
fix sku block
gigitux Mar 21, 2023
960194a
Merge branch 'feat/add-default-single-product-html-template' of https…
gigitux Mar 21, 2023
acea0b6
Merge branch 'trunk' of https://github.com/woocommerce/woocommerce-bl…
gigitux Mar 21, 2023
58785d0
Merge branch 'feat/add-default-single-product-html-template' of https…
gigitux Mar 21, 2023
9874543
Merge branch 'trunk' of https://github.com/woocommerce/woocommerce-bl…
gigitux Mar 22, 2023
37f2665
improve layout
gigitux Mar 22, 2023
ba585ab
improve layout
gigitux Mar 22, 2023
2ccc196
Merge branch 'feat/add-default-single-product-html-template' of https…
gigitux Mar 22, 2023
5b60ed9
improve layout
gigitux Mar 22, 2023
bcc5642
improve layout
gigitux Mar 22, 2023
2762e61
Merge branch 'feat/add-default-single-product-html-template' of https…
gigitux Mar 22, 2023
394ef49
improve layout
gigitux Mar 22, 2023
305931b
Merge branch 'feat/add-default-single-product-html-template' of https…
gigitux Mar 22, 2023
6790097
Merge branch 'trunk' of https://github.com/woocommerce/woocommerce-bl…
gigitux Mar 22, 2023
be3b173
update label
gigitux Mar 22, 2023
b6b1aee
Merge branch 'trunk' into add/8208-convert-single-product
gigitux Mar 22, 2023
a610b6a
Merge branch 'trunk' into add/8208-convert-single-product
gigitux Mar 23, 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
70 changes: 63 additions & 7 deletions assets/js/blocks/classic-template/single-product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,66 @@
* External dependencies
*/
import { __, sprintf } from '@wordpress/i18n';
import { isWpVersion } from '@woocommerce/settings';
import { BlockInstance, createBlock } from '@wordpress/blocks';
import { VARIATION_NAME as PRODUCT_TITLE_VARIATION_NAME } from '@woocommerce/blocks/product-query/variations/elements/product-title';
import { VARIATION_NAME as PRODUCT_SUMMARY_VARIATION_NAME } from '@woocommerce/blocks/product-query/variations/elements/product-summary';

// TODO: Provide the blockified template for the single product page and adjust
// other functions accordingly.
const getBlockifiedTemplate = () => [];
const getBlockifiedTemplate = () =>
[
createBlock( 'woocommerce/breadcrumbs' ),
createBlock(
'core/columns',
{
align: 'wide',
},
[
createBlock(
'core/column',
{
type: 'constrained',
justifyContent: 'right',
},
[ createBlock( 'woocommerce/product-image-gallery' ) ]
),
createBlock( 'core/column', {}, [
createBlock( 'core/post-title', {
__woocommerceNamespace: PRODUCT_TITLE_VARIATION_NAME,
} ),
createBlock( 'woocommerce/product-price', {
fontSize: 'large',
} ),
createBlock( 'core/post-excerpt', {
__woocommerceNamespace: PRODUCT_SUMMARY_VARIATION_NAME,
} ),
createBlock( 'woocommerce/add-to-cart-form' ),
createBlock( 'woocommerce/product-meta' ),
] ),
]
),
createBlock( 'woocommerce/product-details', {
align: 'wide',
} ),
createBlock( 'woocommerce/related-products', {
align: 'wide',
} ),
].filter( Boolean ) as BlockInstance[];

const isConversionPossible = () => false;
const isConversionPossible = () => {
// Blockification is possible for the WP version 6.1 and above,
// which are the versions the Products block supports.
return isWpVersion( '6.1', '>=' );
};

const getDescriptionAllowingConversion = () => '';
const getDescriptionAllowingConversion = ( templateTitle: string ) =>
sprintf(
/* translators: %s is the template title */
__(
"This block serves as a placeholder for your %s. We recommend upgrading to the Single Products block for more features to edit your products visually. Don't worry, you can always revert back.",
'woo-gutenberg-products-block'
),
templateTitle
);

const getDescriptionDisallowingConversion = ( templateTitle: string ) =>
sprintf(
Expand All @@ -23,13 +75,17 @@ const getDescriptionDisallowingConversion = ( templateTitle: string ) =>

const getDescription = ( templateTitle: string, canConvert: boolean ) => {
if ( canConvert ) {
return getDescriptionAllowingConversion();
return getDescriptionAllowingConversion( templateTitle );
}

return getDescriptionDisallowingConversion( templateTitle );
};

const getButtonLabel = () => '';
const getButtonLabel = () =>
__(
'Upgrade to Blockified Single Product template',
'woo-gutenberg-products-block'
);

export {
getBlockifiedTemplate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const INNER_BLOCKS_TEMPLATE: InnerBlockTemplate[] = [
'core/heading',
{
level: 2,
content: __( 'Related products.', 'woo-gutenberg-products-block' ),
content: __( 'Related products', 'woo-gutenberg-products-block' ),
},
],
[
Expand Down