Skip to content
CartPops Docs
Esc
↑↓navigate↵open⌘Jpreview
On this page

Developers

How CartPops V2 is built, and the PHP hooks, browser events, REST routes and CSS you can rely on when you extend it.

This section documents the extension points CartPops V2 supports. Everything listed here was checked against the plugin source. If something is not listed, treat it as internal.

How V2 is built

  • Blocks. The cart drawer and the cart launcher are two WordPress blocks, cartpops/cart-drawer and cartpops/cart-launcher. On themes that do not place them, CartPops renders them for you in wp_footer.
  • WordPress Interactivity API. Cart state in the browser lives in one Interactivity store named cartpops. The store is internal. Classic scripts cannot import it, so use the browser events instead.
  • WooCommerce Store API. The drawer reads and changes the cart through the WooCommerce Store API (/wc/store/v1). CartPops adds its own data under the cartpops extension namespace.
  • cartpops/v1 REST routes. A small set of routes that CartPops’ own interface uses for coupons, recommendations, drawer data and settings. See Store API and REST.
  • Server-rendered drawer. PHP renders the first state of the drawer. After that the browser updates it. The PHP actions around the drawer run once per server render, not on every cart change.

The drawer is not a template you can override. V2 has no theme template folder for it. Use the documented positions and filters instead.

Free and Pro

Free and Pro expose the same hooks and the same names. Three hooks only do anything on a site with an active Pro license, because the feature they change exists only in Pro:

  • cartpops_pro_recommendation_button_presentation
  • cartpops_secondary_btn_classes
  • cartpops_elementor_widget_cart_is_hidden

On a Free site these three are never called, so a callback is harmless but has no effect.

What is covered

Safety rules that apply everywhere

CartPops treats filter results as untrusted input. Most filters validate what you return and fall back to a safe value if it is wrong. A fallback is silent, so if a filter seems to be ignored, check the accepted values on its page. Several filters also catch exceptions thrown by your callback. The ones that do not are marked on their page.

Was this page helpful?