register_block_type_from_metadata( __DIR__ . '/build' ); } } add_action( 'init', '{{namespaceSnakeCase}}_{{slugSnakeCase}}_block_init' ); function {{namespaceSnakeCase}}_{{slugSnakeCase}}_add_block_to_product_editor( BlockTemplateInterface $template ) { if ( $template instanceof ProductFormTemplateInterface && 'simple-product' === $template->get_id() ) { $basic_details = $template->get_section_by_id( 'basic-details' ); if ( $basic_details ) { $basic_details->add_block( [ 'id' => '{{namespace}}-{{slug}}', 'order' => 40, 'blockName' => '{{namespace}}/{{slug}}', 'attributes' => [ 'message' => '{{title}}', ] ] ); } } } add_filter( 'woocommerce_block_template_register', '{{namespaceSnakeCase}}_{{slugSnakeCase}}_add_block_to_product_editor', 100 );