Merge pull request #2464 from woocommerce/PCP-3374-google-pay-button-not-displayed-in-the-word-press-editor

Fix the Google Pay button in the block Checkout in the editor (3374)
This commit is contained in:
Emili Castells 2024-10-03 10:39:01 +02:00 committed by GitHub
commit 8592213b9a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 100 additions and 10 deletions

View file

@ -17,7 +17,7 @@ class ApplePayManagerBlockEditor {
async config() {
try {
this.applePayConfig = await paypal.Applepay().config();
this.applePayConfig = await ppcpBlocksEditorPaypalApplepay.Applepay().config();
const button = new ApplePayButton(
this.ppcpConfig.context,

View file

@ -12,6 +12,7 @@ const ppcpConfig = ppcpData.scriptData;
const buttonData = wc.wcSettings.getSetting( 'ppcp-applepay_data' );
const buttonConfig = buttonData.scriptData;
const dataNamespace = 'ppcpBlocksEditorPaypalApplepay';
if ( typeof window.PayPalCommerceGateway === 'undefined' ) {
window.PayPalCommerceGateway = ppcpConfig;
@ -38,6 +39,10 @@ const ApplePayComponent = ( props ) => {
ppcpConfig.url_params.components += ',applepay';
if ( props.isEditing ) {
ppcpConfig.data_namespace = dataNamespace;
}
// Load PayPal
loadPaypalScript( ppcpConfig, () => {
setPaypalLoaded( true );