Skip to main content
Fetch vouchers on the server, cache them, and link each one to its storefront page with url. Never call the API from the browser: the bearer token would be visible to every visitor, and cross-origin browser requests are not enabled.

Choose which vouchers to show

  • A category: pass category_id to /tenants/{tenant}/catalog/vouchers. The response follows the positions saved in that category and returns each position as sort_order.
  • A hand-picked list: create a category in GVB, mark it Hidden, and add the vouchers to it. A hidden category stays out of the shop’s own listings but still works as a category_id filter. Find its identifier with /catalog/categories?include_hidden=true.
  • Best sellers: pass best_sellers=true and order by best_seller_rank. The list follows the shop’s Best Sellers setting, so it is empty when that setting is off.
Vouchers that are hidden, disabled, or outside their schedule are never returned.

Example

Store the token outside the theme, for example as a constant in wp-config.php. The transient keeps the feed for 15 minutes so page views do not count against the rate limit.
Render each voucher from title, summary, image_url, and from_sale_price (falling back to from_price, sale_price, then price), and link it to url. Escape every value on output.

Token

Create a token in API Access with view_vouchers, plus view_categories if the site reads categories. It needs no other permission.