diff --git a/modules/ppcp-applepay/resources/js/ApplepayButton.js b/modules/ppcp-applepay/resources/js/ApplepayButton.js index 024782a1d..4d135bce5 100644 --- a/modules/ppcp-applepay/resources/js/ApplepayButton.js +++ b/modules/ppcp-applepay/resources/js/ApplepayButton.js @@ -437,28 +437,32 @@ class ApplePayButton { addButton() { this.log( 'addButton' ); - const appleContainer = document.getElementById( this.wrapperId ); + const wrapper = this.wrapperElement; const style = this.buttonStyle; const id = 'apple-' + this.wrapperId; - if ( ! appleContainer ) { + if ( ! wrapper ) { return null; } const ppcpStyle = this.ppcpStyle; - appleContainer.innerHTML = ``; - appleContainer.classList.add( 'ppcp-button-' + ppcpStyle.shape ); + wrapper.innerHTML = ``; + wrapper.classList.add( + `ppcp-button-${ ppcpStyle.shape }`, + 'ppcp-button-apm', + 'ppcp-button-applepay' + ); if ( ppcpStyle.height ) { - appleContainer.style.setProperty( + wrapper.style.setProperty( '--apple-pay-button-height', `${ ppcpStyle.height }px` ); - appleContainer.style.height = `${ ppcpStyle.height }px`; + wrapper.style.height = `${ ppcpStyle.height }px`; } - return appleContainer.querySelector( 'apple-pay-button' ); + return wrapper.querySelector( 'apple-pay-button' ); } //------------------------