PayPal Pay Later messaging is added to your store via a script that is loaded to your site's template file. To add the script, follow these steps:

Adding the PayPal Messaging Script

From your store's Admin Dashboard, choose Design > File Editor from the drop-down menu.

On the File Editor page, choose the Theme File by clicking its link in the Shortcuts Menu. Your template number will vary, depending on the theme you are using for your store.

In the template file, scroll down to the bottom of the code and locate the Body Closing Tag.

The Body Closing Tag is located at the very bottom of the HTML code.

Copy and Paste the following script directly Below the Body Closing Tag.

<script>
const addPayPalMessagingWithPrice = () => {
const priceSpans = document.querySelectorAll('span[itemprop="price"]');
if (priceSpans.length === 1) {
const priceString = priceSpans[0].getAttribute('content');
const pricingDiv = document.querySelectorAll('div[itemprop="offers"]')?.[0];
const pricingTable = pricingDiv.querySelectorAll('table')?.[0];
if (pricingDiv && priceString && pricingTable) {
const messagingDiv = document.createElement('div');
messagingDiv.setAttribute('style', 'margin-top:12px;');
messagingDiv.setAttribute('data-pp-message', '');
messagingDiv.setAttribute('data-pp-style-layout', 'text');
messagingDiv.setAttribute('data-pp-style-logo-type', 'inline');
messagingDiv.setAttribute('data-pp-placement', 'product');
messagingDiv.setAttribute('data-pp-style-text-color', 'black');
messagingDiv.setAttribute('data-pp-amount', priceString);
if (pricingTable.nextSibling) {
pricingDiv.insertBefore(messagingDiv, pricingTable.nextSibling);
} else {
pricingDiv.appendChild(messagingDiv);
}
}
}
}
addPayPalMessagingWithPrice();
</script>

Once you have added the script, click the Save button to save your changes.

If you have the Enable Immediate Publish variable unchecked in Settings > Config Variables, you will need to Publish your changes.

To publish you changes, click the blue Publish button located on the right side of the Admin Dashboard drop-down menu.

If you do not see the Publish button after saving your script, then your likely have the Enable Immediate Publish variable checked. No further action is needed.

Testing the PayPal Messaging Script

To test the script and make sure that it is showing the correct messaging, once you have added and saved it, navigate to a product with a price that qualifies for the PayPal Pay Later program. This threshold is set by PayPal, but should be for items over $40.00.

The product should show the correct PayPal messaging.

If the price breakdown is not accurate (price/4) or the position is not optimal, please contact us.


Did this answer your question?