Magento Integration
Add Wewell's intelligent beauty widgets to your Magento 2 store
Overview
Magento 2 offers several ways to integrate Wewell widgets. Choose the method that best fits your technical expertise and customization needs.
Magento Version Support
This guide is designed for Magento 2.x. For Magento 1.x support, please contact our team.
Admin Panel
Use Magento admin to add scripts
- Easy to implement
- No coding required
- Accessible interface
Template Files
Modify theme template files directly
- More control
- Custom placement
- Requires technical knowledge
Custom Module
Create a dedicated Magento module
- Professional approach
- Upgrade-safe
- Advanced users only
Method 1: Admin Panel (Recommended)
Access Magento Admin
Log in to your Magento admin panel
Navigate to Content Settings
Go to Content → Configuration
Select Your Store View
Click "Edit" next to your store view in the list
Find HTML Head Section
Scroll down to "HTML Head" and expand the section
Add Wewell Script
In the "Scripts and Style Sheets" field, add the Wewell script:
<script type="module" src="https://widget.wewell.io/wewell.es.js?v=1"></script>
Save Configuration
Click "Save Configuration" and clear the cache
Clear Cache
Go to System → Cache Management and flush all cache types for changes to take effect.
Method 2: Template Files
Important Notice
Always backup your files and use a custom theme to prevent losing changes during updates.
Locate Theme Files
Navigate to your active theme directory:
Edit Layout File
Modify one of these files:
- Magento_Theme/layout/default.xml
- Magento_Theme/layout/default_head_blocks.xml
- Magento_Catalog/layout/catalog_product_view.xml
Add Script Block
Add this code within the <head> section:
<referenceContainer name="head.additional">
<block class="Magento\Framework\View\Element\Text" name="wewell.scripts">
<arguments>
<argument name="text" xsi:type="string"><![CDATA[
<script type="module" src="https://widget.wewell.io/wewell.es.js?v=1"></script>
]]></argument>
</arguments>
</block>
</referenceContainer>
Deploy and Clear Cache
Run these commands in your Magento root:
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
php bin/magento cache:flush
Method 3: Custom Module (Advanced)
Developer Method
This approach creates a proper Magento 2 module for maximum flexibility and upgrade safety.
Create Module Structure
Create the following directory structure:
Create Registration File
Create registration.php
:
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Wewell_Integration',
__DIR__
);
Create Module Configuration
Create etc/module.xml
:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Wewell_Integration" setup_version="1.0.0"/>
</config>
Create Layout File
Create view/frontend/layout/default.xml
:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<script type="module" src="https://widget.wewell.io/wewell.es.js?v=1"></script>
</head>
<body>
<referenceContainer name="before.body.end">
</referenceContainer>
</body>
</page>
Enable Module
Run these commands to enable the module:
php bin/magento module:enable Wewell_Integration
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
php bin/magento cache:flush
Verification & Testing
How to Verify Integration
Troubleshooting
Cache Issues
Static Content Issues
CSP (Content Security Policy)
Need Help?
Our Magento specialists are ready to assist with your integration: