Skip to content

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.

  1. Get your API key from the GoPayLocal dashboard

  2. 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>:

    <script
    src="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:

    1. Go to Plugins > Add New
    2. Search for “WPCode” and install
    3. Go to Code Snippets > Header & Footer
    4. Paste the script tag in the Footer section
    5. Save
  3. Configure discounts in the GoPayLocal dashboard

That’s it. The banner will appear for visitors from countries with lower purchasing power.

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 automatically
add_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.

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>