Show paylater amount in editor if cart/checkout

This commit is contained in:
Alex P 2023-12-14 10:36:15 +02:00
parent c8632e3826
commit 90d8fcc530
No known key found for this signature in database
GPG key ID: 54487A734A204D71

View file

@ -14,6 +14,12 @@ export default function Edit( { attributes, clientId, setAttributes } ) {
const [rendered, setRendered] = useState(false);
let amount = undefined;
const postContent = String(wp.data.select('core/editor')?.getEditedPostContent());
if (postContent.includes('woocommerce/checkout') || postContent.includes('woocommerce/cart')) {
amount = 50.0;
}
const previewStyle = {
layout,
logo: {
@ -152,6 +158,7 @@ export default function Edit( { attributes, clientId, setAttributes } ) {
<div className={'ppcp-overlay-child'}>
<PayPalMessages
style={previewStyle}
amount={amount}
onRender={() => setRendered(true)}
/>
</div>