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.
Метод класса: Installer{}
Хуков нет.
Возвращает
Массив.
Использование
$Installer = new Installer(); $Installer->create_pages( $pages );
- $pages(массив) (обязательный)
- Default pages.
Код Installer::create_pages() Installer::create pages WC 10.5.0
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;
}