Register block in PHP and Add default opt in text when saving example block in `@woocommerce/extend-cart-checkout-block` (#48581)

This commit is contained in:
Thomas Roberts 2024-07-10 12:07:02 +01:00 committed by GitHub
parent eaf57e9f15
commit b94fd1127d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 2 deletions

View File

@ -20,6 +20,7 @@
*/
add_action( 'woocommerce_blocks_loaded',
function () {
register_block_type_from_metadata( __DIR__ . '/build/js/checkout-newsletter-subscription-block' );
require_once __DIR__ . '/{{slug}}-blocks-integration.php';
add_action(
'woocommerce_blocks_cart_block_registration',

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Ensures the default text shows when saving the example newsletter subscription block.

View File

@ -43,7 +43,7 @@ export const Save = ( { attributes } ) => {
const { text } = attributes;
return (
<div { ...useBlockProps.save() }>
<RichText.Content value={ text } />
<RichText.Content value={ text || optInDefaultText } />
</div>
);
};
};