About the Javascript API

The Plugin uses the new WordPress Hooks Javascript API. Please check the official documentation about the basic usage.

The main plugin instance is available as sfw or window.sfw. To make sure the plugin was already initiated, you should add the sfw-core handle as dependency to your scripts. Read more about the included files under Scripts & Styles.

If you need to load your code earlier, you may add it as dependency to sfw-core via the sfw/js/core_dependencies filter.

The main config

To change the main config, you can use the following filters

sfw/jsRuns only when the Shop is configured
sfw/wp_localize_scriptRuns always

It is also possible to change it on the Javascript Side with sfw.config

The best way to see what info the default config contains, is to enter ‘sfw’ into your Browser Console after the page was loaded.


sfw.get( string key )

Retrieve a config value

sfw.set( string key, mixed value )

Set a config value

sfw.api, sfw.spreadshirt, sfw.spreadshirtAPI, sfw.proxy

See PHP Proxy


Please note that you can differentiate between Php and Javascript Hooks by their naming. PHP Hooks will usually start with sfw/ while Javascript Hooks start with sfw.

sfw.config settings objectFilterChange the main config before the plugin is initiated
sfw.register.pluginssfw instance, jQuery instanceActionUsed to create Plugins
sfw.readysfw instance, jQuery instanceActionRuns when everything is ready