mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
Allow to add paylater block inside block cart/checkout
This commit is contained in:
parent
910c6ccb6d
commit
ccc0e263dd
1 changed files with 16 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
||||||
import { registerBlockType } from '@wordpress/blocks';
|
import { registerBlockType } from '@wordpress/blocks';
|
||||||
|
import { registerCheckoutFilters } from '@woocommerce/blocks-checkout';
|
||||||
|
|
||||||
import Edit from './edit';
|
import Edit from './edit';
|
||||||
import save from './save';
|
import save from './save';
|
||||||
|
@ -13,8 +14,22 @@ const paypalIcon = (
|
||||||
</svg>
|
</svg>
|
||||||
)
|
)
|
||||||
|
|
||||||
registerBlockType( 'woocommerce-paypal-payments/paylater-messages', {
|
const blockId = 'woocommerce-paypal-payments/paylater-messages';
|
||||||
|
|
||||||
|
registerBlockType( blockId, {
|
||||||
icon: paypalIcon,
|
icon: paypalIcon,
|
||||||
edit: Edit,
|
edit: Edit,
|
||||||
save,
|
save,
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
document.addEventListener( 'DOMContentLoaded', () => {
|
||||||
|
// allow to add this block inside WC cart/checkout blocks
|
||||||
|
registerCheckoutFilters( blockId, {
|
||||||
|
additionalCartCheckoutInnerBlockTypes: (
|
||||||
|
defaultValue
|
||||||
|
) => {
|
||||||
|
defaultValue.push( blockId );
|
||||||
|
return defaultValue;
|
||||||
|
},
|
||||||
|
} );
|
||||||
|
} );
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue