mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
Show paylater amount in editor if cart/checkout
This commit is contained in:
parent
c8632e3826
commit
90d8fcc530
1 changed files with 7 additions and 0 deletions
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue