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-drawerandcartpops/cart-launcher. On themes that do not place them, CartPops renders them for you inwp_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 thecartpopsextension namespace. cartpops/v1REST 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_presentationcartpops_secondary_btn_classescartpops_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
PHP actions
cartpops_loaded and the 18 drawer positions where you can print markup.
PHP filters
URLs, the open-on-add trigger, cart item presentation, launcher attributes, REST origins and more.
JavaScript
Open or close the drawer from your own code and keep a header counter in sync.
Store API and REST
The cartpops Store API namespace, the add-to-cart fragment and the cartpops/v1 routes.
CSS customization
Custom properties, stable class names and where Custom CSS loads.
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.