This repository was archived by the owner on Feb 23, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -24,14 +24,23 @@ public function install() {
2424 }
2525
2626 /**
27- * Modifies default page content.
27+ * Modifies default page content replacing it with classic shortcode block.
28+ * We check for shortcode as default because after WooCommerce 8.3, block based checkout is used by default.
29+ * This only runs on Tools > Create Pages as the filter is not applied on WooCommerce plugin activation.
2830 *
2931 * @param array $pages Default pages.
3032 * @return array
3133 */
3234 public function create_pages ( $ pages ) {
33- $ pages ['cart ' ]['content ' ] = '<!-- wp:woocommerce/classic-shortcode {"shortcode":"cart"} /--> ' ;
34- $ pages ['checkout ' ]['content ' ] = '<!-- wp:woocommerce/classic-shortcode {"shortcode":"checkout"} /--> ' ;
35+
36+ if ( '<!-- wp:shortcode -->[woocommerce_cart]<!-- /wp:shortcode --> ' === $ pages ['cart ' ]['content ' ] ) {
37+ $ pages ['cart ' ]['content ' ] = '<!-- wp:woocommerce/classic-shortcode {"shortcode":"cart"} /--> ' ;
38+ }
39+
40+ if ( '<!-- wp:shortcode -->[woocommerce_checkout]<!-- /wp:shortcode --> ' === $ pages ['checkout ' ]['content ' ] ) {
41+ $ pages ['checkout ' ]['content ' ] = '<!-- wp:woocommerce/classic-shortcode {"shortcode":"checkout"} /--> ' ;
42+ }
43+
3544 return $ pages ;
3645 }
3746
You can’t perform that action at this time.
0 commit comments