WordPress
Add GoPayLocal PPP discounts to your WordPress site.
Add GoPayLocal to any WordPress site by adding the banner script to your theme’s header or footer.
Installation
Section titled “Installation”-
Get your API key from the GoPayLocal dashboard
-
Add the script to your site
Go to Appearance > Theme File Editor (or use a plugin like “Insert Headers and Footers”) and add the script before
</body>:<scriptsrc="https://api.gopaylocal.com/v1/banner/script.js?key=gpl_pk_live_abc123"async></script>Using a plugin (recommended):
Install “WPCode” or “Insert Headers and Footers” plugin:
- Go to Plugins > Add New
- Search for “WPCode” and install
- Go to Code Snippets > Header & Footer
- Paste the script tag in the Footer section
- Save
-
Configure discounts in the GoPayLocal dashboard
That’s it. The banner will appear for visitors from countries with lower purchasing power.
WooCommerce
Section titled “WooCommerce”If you’re using WooCommerce, the banner script works on product and checkout pages. For auto-apply functionality, you’ll need a custom integration:
// functions.php — Apply GoPayLocal coupon automaticallyadd_action('woocommerce_before_checkout_form', function() { // Check for GoPayLocal coupon in the URL if (isset($_GET['gpl_code'])) { $code = sanitize_text_field($_GET['gpl_code']); if (!WC()->cart->has_discount($code)) { WC()->cart->apply_coupon($code); } }});Then configure your banner to link to checkout with the coupon code.
Data Attributes with WordPress
Section titled “Data Attributes with WordPress”Use data attributes on your pricing page:
<div class="pricing-card"> <h3>Pro Plan</h3> <span data-gopaylocal-price="9.99">$9.99</span>/mo</div>
<script type="module"> import { GoPayLocal } from 'https://esm.sh/@gopaylocal/js'; const gpl = new GoPayLocal({ apiKey: 'gpl_pk_live_abc123' }); await gpl.init(); gpl.bindPriceElements();</script>