Skip to content

Commit

Permalink
Fix non-rendering PMME container on cart block for specific scenario (#…
Browse files Browse the repository at this point in the history
…10455)

Co-authored-by: Guilherme Pressutto <[email protected]>
  • Loading branch information
timur27 and gpressutto5 authored Feb 27, 2025
1 parent 03f6b03 commit 24efde2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 20 deletions.
4 changes: 4 additions & 0 deletions changelog/fix-pmme-on-cart-block
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: fix

Init PMME container in cart block so that it can be dynamically rendered once the requirements are met.
24 changes: 4 additions & 20 deletions client/cart/blocks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,10 @@
* Internal dependencies
*/
import { renderBNPLCartMessaging } from './product-details';
import { getUPEConfig } from 'wcpay/utils/checkout';

const { registerPlugin } = window.wp.plugins;

const paymentMethods = getUPEConfig( 'paymentMethodsConfig' ) || {};

const BNPL_PAYMENT_METHODS = {
AFFIRM: 'affirm',
AFTERPAY: 'afterpay_clearpay',
KLARNA: 'klarna',
};

const bnplPaymentMethods = Object.values( BNPL_PAYMENT_METHODS ).filter(
( method ) => method in paymentMethods
);

if ( bnplPaymentMethods.length ) {
// Register BNPL site messaging on the cart block.
registerPlugin( 'bnpl-site-messaging', {
render: renderBNPLCartMessaging,
scope: 'woocommerce-checkout',
} );
}
registerPlugin( 'bnpl-site-messaging', {
render: renderBNPLCartMessaging,
scope: 'woocommerce-checkout',
} );

0 comments on commit 24efde2

Please sign in to comment.