Automattic\WooCommerce\Blocks
Installer::create_pages()
Modifies default page content replacing it with classic shortcode block. We check for shortcode as default because after WooCommerce 8.3, block-based checkout is used by default. This only runs on Tools > Create Pages as the filter is not applied on WooCommerce plugin activation.
Method of the class: Installer{}
No Hooks.
Return
Array
.
Usage
$Installer = new Installer(); $Installer->create_pages( $pages );
- $pages(array) (required)
- Default pages.
Installer::create_pages() Installer::create pages code WC 9.8.2
public function create_pages( $pages ) { if ( '<!-- wp:shortcode -->[woocommerce_cart]<!-- /wp:shortcode -->' === ( $pages['cart']['content'] ?? null ) ) { $pages['cart']['content'] = '<!-- wp:woocommerce/classic-shortcode {"shortcode":"cart"} /-->'; } if ( '<!-- wp:shortcode -->[woocommerce_checkout]<!-- /wp:shortcode -->' === ( $pages['checkout']['content'] ?? null ) ) { $pages['checkout']['content'] = '<!-- wp:woocommerce/classic-shortcode {"shortcode":"checkout"} /-->'; } return $pages; }