When installing the WeltPixel Google Analytics 4 (GA4) PRO extension on a Magento 2 instance that already uses older WeltPixel modules (e.g., Pearl Theme or other extensions), you may encounter an autoload error related to the shared Backend module. This guide outlines how to resolve such conflicts to ensure successful installation and integration.
Understanding the Conflict and Autoload Error
All WeltPixel modules rely on a shared Backend module to provide administrative functionality within the Magento Admin. This shared module must only exist in one location to avoid autoloading errors, typically triggered when Magento detects duplicate modules in both app/code and vendor directories.
Locations where the module might be installed:
- Manual Installation: app/code/WeltPixel/Backend
- Composer Installation: vendor/weltpixel/module-backend
Magento does not allow the same module to exist in both locations simultaneously, which leads to an autoload error.
Common Scenario
If your Magento store uses older WeltPixel extensions installed manually in app/code, and you’re trying to install GA4 PRO via Composer, you may receive an autoload error due to the Backend module being defined in two places.
Solution Options
Option 1: Manual Installation of GA4 PRO
Download the GA4 PRO ZIP package from your WeltPixel account. Extract the contents and locate the GA4 and Backend folders. Copy both folders into app/code/WeltPixel/ on your server. If the Backend extension already exists in app/code, replace it with the newer version from the GA4 PRO package. Run the following Magento CLI commands:
php bin/magento setup:upgrade php bin/magento setup:di:compile php bin/magento cache:flush
This ensures all extensions remain consistent and use the latest version of the shared Backend module, thereby avoiding the autoload error.
Option 2: Switch Entirely to Composer Installation
Delete the existing Backend folder from app/code/WeltPixel:
rm -rf app/code/WeltPixel/Backend
Install GA4 PRO using Composer (ensure your composer credentials are active):
composer require weltpixel/module-ga4-pro composer update php bin/magento setup:upgrade php bin/magento setup:di:compile php bin/magento cache:flush
This method consolidates all extensions into the vendor directory, resolving the autoload error.
Conclusion
To avoid module conflicts and autoload errors, ensure that all WeltPixel extensions consistently use the same installation method—either manual or via Composer. Upgrading the Backend module to the latest version is essential for compatibility with newer modules like GA4 PRO.
If you experience further issues or need tailored guidance, contact WeltPixel Support with details about your current setup.
Comments
0 comments
Please sign in to leave a comment.