0

I am new to Magento development and finding the process a little overwhelming. I am a Javascript developer without any PHP experience. To help me get started I decided to Vue Storefront's SDKs (using NextJS). So far it's working great.

I would like to extend my store by creating an extension that I can share with other Magento developers in the future (ideally on Adobe marketplace). Can I create this using Javascript or do I have to write this in PHP?

The extension will be responsible for a few things, such as adding more functionality to products.

My initial thought was to create a NPM package using the magento-api package, would this be a way to create an extension?

1 Answer 1

0

You have to use the PHP to register and create an extension in the Magento. If you want to something related product, then you have to customize the existing logic of the Magneto, that is written in the PHP.

If you want to do some changes on the design side, then you can use the JavaScript.

For registering an extension in magento2, you can follow these steps:

Create Extension Directory:
Start by creating a directory for your extension in the app/code directory of your Magento installation. The directory structure should follow the pattern: app/code/Vendor/Extension


mkdir -p app/code/Vendor/Extension

Create Registration File: Inside your extension directory, create a registration.php file. This file is required and should contain code to register your extension.

// app/code/Vendor/Extension/registration.php
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'Vendor_Extension',
    __DIR__
);

Create Module Configuration File: Create a file named module.xml inside the etc directory of your extension.

<!-- app/code/Vendor/Extension/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="Vendor_Extension" setup_version="1.0.0">
        <!-- Additional module configurations can go here -->
    </module>
</config>

Enable the Module: After creating the registration and module files, enable the module by running the following command from your Magento root directory:

php bin/magento module:enable Vendor_Extension

Run Upgrade Command: If your extension requires a database schema or other setup, you might need to run the upgrade Command. This is done using the following command:

php bin/magento setup:upgrade

Clear Cache: After enabling the module, clear the Magento cache:

php bin/magento cache:clean

Verify Installation: Verify that your module is installed and active by checking the list of enabled modules:

php bin/magento module:status

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.