Documentation





PCR Pickup & Delivery Checker Popup for WooCommerce — Documentation (v1.2.1)

PCR Pickup & Delivery Checker Popup for WooCommerce

Popup for Pickup/Delivery, Google distance check, address autocompletion, and distance‑based minimum order — by Nav.
Contents

  1. Requirements
  2. Install & Activate
  3. Google Cloud & API Keys (Billing & Restrictions)
  4. Configure Plugin Settings
  5. How it works (Storefront)
  6. Distance-based Minimum Order
  7. Troubleshooting
  8. FAQ
  9. Support

1) Requirements

  • WordPress 6.2+ and WooCommerce 7.8+ (tested up to WC 9.3).
  • Google Cloud project with Billing enabled.
  • Two Google API Keys (separate keys): Browser Key (Maps JavaScript + Places, restricted by HTTP referrer) and Server Key (Distance Matrix + Geocoding, restricted by server IP).

2) Install & Activate

  1. Upload the ZIP in WP Admin → Plugins → Add New → Upload.
  2. Activate PCR Delivery Checker for WooCommerce.
  3. Go to Settings → PCR Delivery.

3) Google Cloud & API Keys (Billing & Restrictions)

Important: Before creating keys, you must have Billing enabled on your Google Cloud project.
Open: Enable Billing

3.1 Enable required APIs

  1. Go to Google Cloud Console → select (or create) your project.
  2. Open APIs & Services → Library.
  3. Enable the following:
    • Maps JavaScript API
    • Places API
    • Distance Matrix API
    • Geocoding API

3.2 Create the Browser Key (Autocomplete)

  1. Open APIs & Services → CredentialsCreate credentials → API key.
  2. Rename it e.g. Browser – Maps JS + Places.
  3. Click the key → set Application restrictions to HTTP referrers (web sites).
  4. Add your domain pattern, e.g. https://yourdomain.com/* (include www if applicable).
  5. Set API restrictions to Restrict key, then allow:
    • Maps JavaScript API
    • Places API
  6. Save. Paste this key into Settings → Maps JavaScript API key.

3.3 Create the Server Key (Distance)

  1. Again in CredentialsCreate credentials → API key.
  2. Rename it e.g. Server – Distance Matrix + Geocoding.
  3. Click the key → set Application restrictions to IP Addresses.
  4. Add your server IP (ask your host; for dual-stack, add both IPv4/IPv6 if used).
  5. Set API restrictions to Restrict key, then allow:
    • Distance Matrix API
    • Geocoding API
  6. Save. Paste this key into Settings → Distance Matrix API key.

Why two keys? Browser key uses HTTP referrer restriction; Server key uses IP restriction to secure backend calls.

4) Configure Plugin Settings

  1. Enter your Store address (origin).
  2. Set Max delivery distance (km).
  3. Choose where the popup appears: Shop, Product, Category, Tag.
  4. (Optional) Delete plugin data on uninstall while testing.
Settings screen (1)
Settings screen (2)
Settings screen (3)

5) How it works (Storefront)

  1. First visit → popup asks Pickup or Delivery.
  2. Delivery → enter address (autocomplete via Browser key).
  3. Click Check delivery to calculate distance via Server key.
  4. Save & continue stores choice + distance for this session and prefills checkout.
  5. After successful order, the popup resets and shows once next visit.

6) Distance-based Minimum Order

  • € per km: 10 means 1km→10€, 2km→20€, etc.
  • Rounding: ceil (recommended), nearest, or floor.
  • Exclude categories: e.g., Drinks not counted toward the minimum.

7) Troubleshooting

  • Popup missing: test in Incognito; ensure on Shop/Product/Category/Tag; clear with ?pcr_reset=1.
  • Google error REQUEST_DENIED: check Billing + API enablement + restrictions.
  • Minimum not enforced: set order type to Delivery; ensure distance stored; check excluded categories.
  • Avoid caching Cart/Checkout/admin-ajax.php.

8) FAQ

Two keys? Yes—Browser (referrer) for JS, Server (IP) for backend calls.

Standalone? Works without WooFood. It’s a WooCommerce add-on.

Reset? Add ?pcr_reset=1 while testing.

9) Support

Author: Nav. When contacting support, include WP/WC versions and any browser console/network errors. © 2025 Nav — PCR Delivery Checker for WooCommerce (v1.2.1)