Hooks for developers: build add-ons for funnelzi

By funnelzi · Last updated:

Why does funnelzi have hooks for add-ons?

funnelzi keeps its own products, orders and checkout. An add-on can sell through another store instead, for example a shop plugin that already has its products and payments, and still use the funnel pages, the canvas and the flow of funnelzi. The filters below are the points where an add-on steps in. They exist in funnelzi 1.2.0 and later.

How does an add-on know that the checkout can be replaced?

funnelzi defines the constant FUNNELZI_CHECKOUT_FILTER as true when the checkout filter is available. Test for it before you rely on the hooks, and show a notice in the admin if the installed funnelzi is older.

Which filters are available?

  • funnelzi_checkout_html receives null, the step and the shortcode attributes. Return the HTML of the checkout of that step to replace the funnelzi checkout. Return null to keep it.
  • funnelzi_offer_html receives null, the step and an array with the texts of the buttons and the addresses to accept or decline. Return the HTML of the one-click offer.
  • funnelzi_summary_html receives null, the order code and the attributes. Return the HTML of the order summary shown on the thank-you step.
  • funnelzi_purchase_data receives null and the order code. Return an array with id, value and currency so the Purchase event of Meta, GA4 and TikTok is sent for a sale that funnelzi does not hold.
  • funnelzi_order_token_valid receives false and the order code. Return true if your add-on recognises that code, so the funnel pages accept it like a funnelzi order.
  • funnelzi_currencies receives the list of currencies, code and symbol. Add yours to make it available on products and prices.

What does funnelzi do when no add-on answers?

Nothing changes. Every filter starts with null or false, so a site without an add-on behaves exactly as before.

Is there a ready-made example?

The add-on that connects funnelzi to a store is built on these filters. When it is published you will find it linked from the documentation. For help with your own add-on, open a ticket from the support page.

Quick answers

Which version of funnelzi has these filters?

Version 1.2.0 and later.

Do the filters change anything on a normal site?

No. Without an add-on every filter returns its starting value and funnelzi works as before.

How do I add a currency?

Add its code and symbol to the list passed to the funnelzi_currencies filter.

Can an add-on report its sales to Meta, GA4 and TikTok?

Yes. Return the id, the value and the currency from the funnelzi_purchase_data filter.

Keep reading

Official sites: Stripe docs · WordPress documentation