https://embed.notionlytics.com/wt/ZXlKd1lXZGxTV1FpT2lJM01ESTVNMlV4WW1RNVpUQTBZbU5sWVdSbE5qZzJPR000TnpCbE1HSTFNeUlzSW5kdmNtdHpjR0ZqWlZSeVlXTnJaWEpKWkNJNklrbGpiM1pzV2pOcU1VUnBRM1ZUUm1WNFRtdHlJbjA9

ScandiPWA is installed as an NPM module in the node_modules directory. This means we can not modify its source directly. We still have to, in order to change the application's appearance or extend its functionality. In order to do it, 2 options exist:

<aside> ➡️ This guide will focus on plugins. To modify the appearance of the app, please use the override mechanism. How to override a file?

</aside>

What is a plugin?

Generally speaking, you want to create a proxy between the original function and a function caller. The function caller will inject into the execution flow of the original function and will edit its behavior as you want it to be.

In the context of ScandiPWA, a plugin is a JavaScript file. It can be injected into functions, methods, static properties, and even into classes.

plugin-2.png

For example, you have an AddToCart class that adds a user-selected product to the cart. You need the additional property inCart: true to be assigned to this product. The best way to do this is to use a plugin for this class in which you should write a logic to this action.

How should a plugin be named?

A plugin should be named according to the file it is injecting into by adding the plugin postfix:

Some file: <FILE_NAME>.js
Plugin:    <FILE_NAME>.**plugin**.js 

What can be plugin created for?

Using the plugin, you can redefine the behavior and properties of objects in the application. We can