### Add and Enable an Example Local Module
Source: https://github.com/adobedocs/commerce-learn.en/blob/main/help/global-reference-architecture/bulk-packages.md
This section details the steps to download, unzip, and prepare an example local module. It then instructs Composer to require the module and enables it within the Adobe Commerce application.
```bash
mkdir -p packages/local
cd packages/local
mkdir antonevers
cd antonevers
curl -OL https://github.com/AntonEvers/module-example-local/archive/refs/heads/main.zip
unzip main.zip
rm main.zip
mv module-example-local-main module-local
git add module-local
cd ../../..
composer require antonevers/module-local:@dev
bin/magento module:enable AntonEvers_Local
bin/magento test:local
```
--------------------------------
### Install GRA Bulk Foundation from Source
Source: https://github.com/adobedocs/commerce-learn.en/blob/main/help/global-reference-architecture/bulk-packages.md
This command removes an existing vendor directory and then installs the GRA bulk foundation package using Composer's `--prefer-source` option, enabling Git within the package directory.
```bash
rm -r vendor/antonevers/gra-bulk-foundation
composer install --prefer-source
```
--------------------------------
### Install and Enable IO Events Modules (Bash)
Source: https://github.com/adobedocs/commerce-learn.en/blob/main/help/io-events/2-4-5-installation.md
Installs the `magento/commerce-eventing` module, updates dependencies, generates eventing modules, enables all modules, and runs necessary setup commands for Adobe Commerce. This is typically used for on-premise installations.
```bash
composer require magento/commerce-eventing=^1.0 --no-update
composer update
bin/magento events:generate:module
bin/magento module:enable --all
bin/magento setup:upgrade && bin/magento setup:di:compile
```
--------------------------------
### Run On-Premise Installation Commands for Adobe Commerce 2.4.6
Source: https://github.com/adobedocs/commerce-learn.en/blob/main/help/io-events/2-4-6-installation.md
These bash commands are used to install and enable IO events modules for Adobe Commerce 2.4.6 in an on-premise hosting environment. They include generating a module, enabling all modules, and performing setup upgrades and compilation.
```bash
bin/magento events:generate:module
bin/magento module:enable --all
bin/magento setup:upgrade && bin/magento setup:di:compile
```
--------------------------------
### Install Local Module with Composer and Magento CLI (Bash)
Source: https://github.com/adobedocs/commerce-learn.en/blob/main/help/global-reference-architecture/split-git.md
Installs a local module by downloading it, requiring it with Composer, enabling it via the Magento CLI, and committing the changes. This process is used for modules intended for the local code pool.
```bash
cd gra-split-brand-x
cd packages/local
mkdir antonevers
cd antonevers
curl -OL https://github.com/AntonEvers/module-example-local/archive/refs/heads/main.zip
unzip main.zip
rm main.zip
mv module-example-local-main module-local
git add module-local
cd ../../..
composer require antonevers/module-local:@dev
bin/magento module:enable AntonEvers_Local
bin/magento test:local
```
--------------------------------
### Configure Module: XML
Source: https://github.com/adobedocs/commerce-learn.en/blob/main/help/backend-development/add-product-attribute.md
Defines the basic configuration for the 'Learning_ClothingMaterial' module in Adobe Commerce. It includes the module name and a setup version, which is necessary for the execution of setup scripts like InstallData.php. Ensure setup_version is included for legacy projects or when setup scripts are required.
```xml
```
--------------------------------
### Install Adobe Commerce in Brand Repository
Source: https://github.com/adobedocs/commerce-learn.en/blob/main/help/global-reference-architecture/split-git.md
This command installs Adobe Commerce into the gra-split-brand-x repository using Composer. It then moves the composer.json file to the root of the repository, cleans up temporary files, and commits the changes to establish the Commerce instance within the brand-specific repository.
```bash
composer create-project --no-install --repository-url=https://repo.magento.com/ magento/project-enterprise-edition temp
mv temp/composer.json ./
rmdir temp
git add composer.json
git commit -m 'install Adobe Commerce'
git push origin main
```
--------------------------------
### Illustrative dig Command with Example URL
Source: https://github.com/adobedocs/commerce-learn.en/blob/main/help/cloud/detect-ip-address.md
This example shows the dig command with a concrete URL structure, illustrating how a cleaned-up URL is used with server prefixes. It uses the +short option to retrieve minimal DNS information for each specified server.
```bash
dig +short 1.aabcikdxbg789.ent.magento.cloud
dig +short 2.abcikdxbg789.ent.magento.cloud
dig +short 3.abcikdxbg789.ent.magento.cloud
```
--------------------------------
### GET /V1/products/{sku} - Get Product
Source: https://github.com/adobedocs/commerce-learn.en/blob/main/help/site-management/create-downloadable-product.md
Retrieves the details of a specific product using its SKU.
```APIDOC
## GET /V1/products/{sku}
### Description
Retrieves the details of a specific product by its SKU.
### Method
GET
### Endpoint
`/rest/default/V1/products/{sku}`
### Parameters
#### Path Parameters
- **sku** (string) - Required - The SKU of the product to retrieve.
### Request Example
```bash
curl --location '{{your.url.here}}/rest/default/V1/products/POSTMAN-download-product-1' \
--header 'Authorization: Bearer {{Your Bearer Token}}' \
--header 'Cookie: PHPSESSID=b78cae2338f12d846d233d4e9486607e; private_content_version=564dde2976849891583a9a649073f01e'
```
### Response
#### Success Response (200)
- **product** (object) - The product details.
#### Response Example
```json
{
"id": 123,
"sku": "POSTMAN-download-product-1",
"name": "Sample Downloadable Product",
"attribute_set_id": 4,
"price": 50.00,
"status": 1,
"visibility": 4,
"type_id": "downloadable",
"created_at": "2023-10-27T11:00:00+00:00",
"updated_at": "2023-10-27T11:00:00+00:00",
"extension_attributes": {
"website_ids": [
1
],
"downloadable_product_links": [
{
"id": 2,
"title": "Download Link 1",
"sort_order": 1,
"is_shareable": "1",
"price": "0.0000",
"number_of_downloads": 0,
"link_type": "file",
"link_file": "/d/o/sample-file.zip",
"sample_type": null
}
],
"downloadable_product_samples": []
}
}
```
```
--------------------------------
### Set up Adobe Commerce Deployment Repository
Source: https://github.com/adobedocs/commerce-learn.en/blob/main/help/global-reference-architecture/bulk-packages.md
Commands to create the main deployment repository for an Adobe Commerce project. This includes creating the directory, installing the Magento project using Composer, initializing Git, and adding the remote origin.
```bash
mkdir gra-bulk-brand-x
cd gra-bulk-brand-x
composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition .
git init
git remote add origin git@github.com:AntonEvers/gra-bulk-brand-x.git
git add composer.json composer.lock
git commit -m 'initialize Brand X repository'
git push -u origin main
```
--------------------------------
### Install and Verify Adobe I/O Events Modules for Commerce
Source: https://context7.com/adobedocs/commerce-learn.en/llms.txt
This set of bash commands is used to install necessary modules, enable them, and perform upgrades for Adobe I/O Events integration in Adobe Commerce 2.4.6. It also includes commands to verify event subscriptions and test event emission.
```bash
# For on-premise hosting
bin/magento events:generate:module
bin/magento module:enable --all
bin/magento setup:upgrade && bin/magento setup:di:compile
# For Adobe Commerce Cloud - check ece-tools version
composer info magento/ece-tools
# Verify event subscriptions
bin/magento events:list
# Test event emission
bin/magento events:info observer.catalog_product_save_after
```
--------------------------------
### Dependency Injection Example in Adobe Commerce Back-end Development
Source: https://github.com/adobedocs/commerce-learn.en/blob/main/help/home/TOC.md
Demonstrates the use of dependency injection in Adobe Commerce back-end development. This pattern is crucial for managing object creation and dependencies.
```php
dependency = $dependency;
}
public function doSomething(): void
{
// Use $this->dependency here
}
}
```
--------------------------------
### GET /rest/default/V1/products/{sku}
Source: https://github.com/adobedocs/commerce-learn.en/blob/main/help/site-management/create-configurable-product.md
Retrieve detailed information about a configurable product, including its linked child product IDs.
```APIDOC
## GET /rest/default/V1/products/{sku}
### Description
Get a configurable product using cURL. This request returns detailed information about the configurable product, including the IDs of associated child products.
### Method
GET
### Endpoint
`/rest/default/V1/products/{sku}`
### Parameters
#### Path Parameters
- **sku** (string) - Required - The SKU of the configurable product.
### Response
#### Success Response (200)
- **configurable_product_links** (array) - An array of IDs for the associated child products.
### Response Example
```json
{
"configurable_product_links": [
155,
157,
156
]
}
```
```
--------------------------------
### Creating a Custom Module
Source: https://context7.com/adobedocs/commerce-learn.en/llms.txt
Guides on how to create a custom module in Adobe Commerce, including registration and module configuration.
```APIDOC
## Creating a Custom Module
### Description
Guides on how to create a custom module in Adobe Commerce, including registration and module configuration.
### Method
N/A (File creation and CLI commands)
### Endpoint
N/A
### Parameters
None
### Request Example
##### `app/code/Training/Sales/registration.php`
```php
```
##### Install the module using CLI:
```bash
bin/magento module:enable Training_Sales
bin/magento setup:upgrade
bin/magento setup:di:compile
```
### Response
N/A
```
--------------------------------
### Install Custom Product Attribute in Magento Setup
Source: https://context7.com/adobedocs/commerce-learn.en/llms.txt
This PHP code installs a custom product attribute named 'clothing_material' during module setup. It uses Magento's EAV setup utility to define the attribute's properties, including its input type, source, frontend, and backend models.
```php
eavSetupFactory = $eavSetupFactory;
}
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
$eavSetup = $this->eavSetupFactory->create();
$eavSetup->addAttribute(
Product::ENTITY,
'clothing_material',
[
'group' => 'Product Details',
'type' => 'varchar',
'label' => 'Clothing Material',
'input' => 'select',
'source' => Source::class,
'frontend' => Frontend::class,
'backend' => Backend::class,
'required' => false,
'sort_order' => 50,
'global' => ScopedAttributeInterface::SCOPE_GLOBAL,
'visible' => true,
'is_html_allowed_on_frontend' => true,
'visible_on_front' => true,
]
);
}
}
```
--------------------------------
### Set up Development Environment with Symlinks (Bash)
Source: https://github.com/adobedocs/commerce-learn.en/blob/main/help/global-reference-architecture/split-git.md
Creates a development environment by copying existing composer files and establishing symbolic links to local, third-party, and GRA package directories. This allows for unified development across different code pools.
```bash
cd ..
mkdir gra-development
cd gra-development
cp ../gra-split-brand-x/composer.json ../gra-split-brand-x/composer.lock .
mkdir packages
ln -s ../../gra-split-brand-x/packages/local/ packages/
ln -s ../../gra-split-3rdparty/packages/3rdparty/ packages/
ln -s ../../gra-split-gra/packages/gra/ packages/
```
--------------------------------
### Create Simple Product using REST API
Source: https://github.com/adobedocs/commerce-learn.en/blob/main/help/site-management/create-bundle-product.md
This command demonstrates how to create a simple product using the REST API. It requires the product's SKU, name, attribute set ID, price, and stock information. Ensure you replace placeholder values like `{{your.url.here}}` and `{{Your Bearer Token}}` with your actual environment details.
```bash
curl --location '{{your.url.here}}/rest/default/V1/products' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{Your Bearer Token}}' \
--header 'Cookie: private_content_version=41d94540f5bd8b691017a850bc3b82b3' \
--data '{
"product": {
"sku": "10-ft-beginner-surfboard",
"name": "10 Foot Beginner surfboard",
"attribute_set_id": 4,
"price": 100,
"type_id": "simple",
"extension_attributes": {
"stock_item": {
"qty": 100,
"is_in_stock":true
}
}
}
}'
```
```bash
curl --location '{{your.url.here}}/rest/default/V1/products' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{Your Bearer Token}}' \
--header 'Cookie: private_content_version=41d94540f5bd8b691017a850bc3b82b3' \
--data '{
"product": {
"sku": "8-ft-surboard-leash",
"name": "8 Foot surboard leash",
"attribute_set_id": 4,
"price": 50,
"type_id": "simple",
"extension_attributes": {
"stock_item": {
"qty": 100,
"is_in_stock":true
}
}
}
}'
```
```bash
curl --location '{{your.url.here}}/rest/default/V1/products' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{Your Bearer Token}}' \
--header 'Cookie: private_content_version=41d94540f5bd8b691017a850bc3b82b3' \
--data '{
"product": {
"sku": "red-fins-and-fin-plugs",
"name": "Red fins and fin plugs",
"attribute_set_id": 4,
"price": 15,
"type_id": "simple",
"extension_attributes": {
"stock_item": {
"qty": 100,
"is_in_stock":true
}
}
}
}'
```
```bash
curl --location '{{your.url.here}}/rest/default/V1/products' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{Your Bearer Token}}' \
--header 'Cookie: private_content_version=41d94540f5bd8b691017a850bc3b82b3' \
--data '{
"product": {
"sku": "blue-fins-and-fin-plugs",
"name": "Blue fins and fin plugs",
"attribute_set_id": 4,
"price": 15,
"type_id": "simple",
"extension_attributes": {
"stock_item": {
"qty": 100,
"is_in_stock":true
}
}
}
}'
```
```bash
curl --location '{{your.url.here}}/rest/default/V1/products' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{Your Bearer Token}}' \
--header 'Cookie: private_content_version=41d94540f5bd8b691017a850bc3b82b3' \
--data '{
"product": {
"sku": "yellow-fins-and-fin-plugs",
"name": "Yellow fins and fin plugs",
"attribute_set_id": 4,
"price": 15,
"type_id": "simple",
"extension_attributes": {
"stock_item": {
"qty": 100,
"is_in_stock":true
}
}
}
}'
```
--------------------------------
### Check ECE-Tools Version for Adobe Commerce Cloud
Source: https://github.com/adobedocs/commerce-learn.en/blob/main/help/io-events/2-4-6-installation.md
This command checks the version of the magento/ece-tools package, which is relevant for Adobe Commerce Cloud environments. It helps ensure compatibility and proper setup for eventing features.
```bash
composer info magento/ece-tools
```
--------------------------------
### Create Bundle Product with Options (Bash)
Source: https://github.com/adobedocs/commerce-learn.en/blob/main/help/site-management/create-bundle-product.md
Creates a new bundle product and assigns simple products as options using a cURL POST request to the Adobe Commerce API. Requires specifying product details, stock information, and bundle product options with their associated child products. Ensure to replace placeholder values like `{{your.url.here}}`, `{{Your Bearer Token}}`, and `attribute_set_id` with your environment's specific details.
```bash
curl --location '{{your.url.here}}/rest/default/V1/products' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{Your Bearer Token}}' \
--header 'Cookie: private_content_version=41d94540f5bd8b691017a850bc3b82b3' \
--data '{
"product": {
"sku": "beginner-surfboard",
"name": "Beginner Surfboard",
"attribute_set_id": 4,
"status": 1,
"visibility": 4,
"type_id": "bundle",
"extension_attributes": {
"stock_item": {
"qty": 100,
"is_in_stock":true
},
"bundle_product_options": [
{
"option_id": 0,
"position": 1,
"sku": "surfboard-essentials",
"title": "Beginners 10ft Surfboard",
"type": "checkbox",
"required": true,
"product_links": [
{
"sku": "10-ft-beginner-surfboard",
"option_id": 1,
"qty": 1,
"position": 1,
"is_default": false,
"price": 100,
"price_type": 0,
"can_change_quantity": 0
}
]
},
{
"option_id": 1,
"position": 2,
"sku": "surboard-leash",
"title": "Surfboard leash",
"type": "checkbox",
"required": true,
"product_links": [
{
"sku": "8-ft-surboard-leash",
"option_id": 2,
"qty": 1,
"position": 1,
"is_default": false,
"price": 50,
"price_type": 0,
"can_change_quantity": 0
}
]
},
{
"option_id": 3,
"position": 2,
"sku": "surfboard-color",
"title": "Choose a color for the fins and fin plugs",
"type": "radio",
"required": true,
"product_links": [
{
"sku": "red-fins-and-fin-plugs",
"option_id": 2,
"qty": 1,
"position": 1,
"is_default": false,
"price": 0,
"price_type": 0,
"can_change_quantity": 0
},
{
"sku": "blue-fins-and-fin-plugs",
"option_id": 2,
"qty": 1,
"position": 2,
"is_default": false,
"price": 0,
"price_type": 0,
"can_change_quantity": 0
},
{
"sku": "yellow-fins-and-fin-plugs",
"option_id": 3,
"qty": 1,
"position": 3,
"is_default": false,
"price": 0,
"price_type": 0,
"can_change_quantity": 0
}
]
}
]
},
"custom_attributes": [
{
"attribute_code": "price_view",
"value": "0"
}
]
},
"saveOptions": true
}'
```
--------------------------------
### Add Clothing Material Product Attribute (PHP)
Source: https://github.com/adobedocs/commerce-learn.en/blob/main/help/backend-development/add-product-attribute.md
This PHP script defines the installation data for a Magento 2 module, specifically adding a custom 'Clothing Material' attribute to the Product entity. It utilizes the EAV setup factory to define the attribute's properties, including its type, label, input method, and visibility settings.
```php
eavSetupFactory = $eavSetupFactory;
}
/**
* @param ModuleDataSetupInterface $setup
* @param ModuleContextInterface $context
* {@inheritDoc}
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @suppressWarnings(PHPMD.ExessiveMethodLength)
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
$eavSetup = $this->eavSetupFactory->create();
$eavSetup->addAttribute(
Product::ENTITY,
'clothing_material',
[
'group' => 'Product Details',
'type' => 'varchar',
'label' => 'Clothing Material',
'input' => 'select',
'source' => Source::class,
'frontend' => Frontend::class,
'backend' => Backend::class,
'required' => false,
'sort_order' => 50,
'global' => ScopedAttributeInterface::SCOPE_GLOBAL,
'is_used_in_grid' => false,
'is_visible_in_grid' => false,
'is_filterable_in_grid' => false,
'visible' => true,
'is_html_allowed_on_frontend' => true,
'visible_on_front' => true,
]
);
}
}
```
--------------------------------
### Initialize and Run App Builder Project (Bash)
Source: https://github.com/adobedocs/commerce-learn.en/blob/main/help/io-events/create-app-builder-project.md
This snippet demonstrates the basic command-line interface (CLI) commands to create a new project directory, log in to Adobe I/O, initialize a new App Builder project, and run the project. These commands are essential for setting up and testing an App Builder application.
```bash
mkdir myproject && cd myproject
aio login
aio app init
aio app run
```
--------------------------------
### Install IO Events Module Dependencies (Bash)
Source: https://github.com/adobedocs/commerce-learn.en/blob/main/help/io-events/2-4-5-installation.md
Installs the `magento/commerce-eventing` module and updates Composer dependencies. It also checks for the `magento/ece-tools` package, which is relevant for Adobe Commerce Cloud environments.
```bash
composer require magento/commerce-eventing=^1.0 --no-update
composer update
composer info magento/ece-tools
```
--------------------------------
### Initialize Monorepo Repository with Composer and Git
Source: https://github.com/adobedocs/commerce-learn.en/blob/main/help/global-reference-architecture/monorepo.md
This snippet outlines the initial setup for the monorepo repository itself. It involves creating the directory, creating the Adobe Commerce project using Composer, initializing Git, setting the remote origin, committing the initial project files including the configuration, and pushing to the main branch.
```bash
mkdir gra-monorepo
cd gra-monorepo
composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition .
git init
git remote add origin git@github.com:AntonEvers/gra-monorepo.git
git add composer.json composer.lock app/etc/config.php
git commit -m 'initialize monorepo GRA development repository'
git push -u origin main
```
--------------------------------
### Initialize Third-Party and GRA Package Storage
Source: https://github.com/adobedocs/commerce-learn.en/blob/main/help/global-reference-architecture/split-git.md
This sequence clones the third-party and GRA repositories, creates dedicated package storage directories within each, and adds a .gitkeep file. Committing and pushing these changes initializes the structure for storing third-party and GRA foundation code, respectively.
```bash
cd ..
git clone git@github.com:AntonEvers/gra-split-3rdparty.git
git clone git@github.com:AntonEvers/gra-split-gra.git
cd gra-split-3rdparty
mkdir -p packages/3rdparty
touch packages/3rdparty/.gitkeep
git add packages/3rdparty/.gitkeep
git commit -m 'initialize 3rd party package storage'
git push origin main
cd ../gra-split-gra
mkdir -p packages/gra
touch packages/gra/.gitkeep
git add packages/gra/.gitkeep
git commit -m 'initialize GRA package storage'
git push origin main
```
--------------------------------
### Install GRA Packages from Source (Bash)
Source: https://github.com/adobedocs/commerce-learn.en/blob/main/help/global-reference-architecture/separate-packages.md
This bash command installs GRA packages from their source Git repositories instead of archives. It first removes existing packages in the 'antonevers' namespace and then runs 'composer install --prefer-source', enabling in-place development within the vendor directory.
```bash
rm -r vendor/antonevers/*
composer install --prefer-source
```
--------------------------------
### POST /V1/products - Create Bundle Product
Source: https://github.com/adobedocs/commerce-learn.en/blob/main/help/site-management/create-bundle-product.md
Creates a new bundle product and assigns simple products as options. Ensure you update the 'attribute_set_id' and other environment-specific values in the request body.
```APIDOC
## POST /V1/products - Create Bundle Product
### Description
Creates a new bundle product by assigning simple products as options. This endpoint allows for the configuration of various product types, including bundle products with selectable options.
### Method
POST
### Endpoint
/rest/default/V1/products
### Parameters
#### Request Body
- **product** (object) - Required - The product data object.
- **sku** (string) - Required - The product's SKU.
- **name** (string) - Required - The product's name.
- **attribute_set_id** (integer) - Required - The ID of the attribute set.
- **status** (integer) - Required - The product's status (e.g., 1 for enabled).
- **visibility** (integer) - Required - The product's visibility setting.
- **type_id** (string) - Required - The product type, should be 'bundle' for this endpoint.
- **extension_attributes** (object) - Optional - Contains stock and bundle option information.
- **stock_item** (object) - Optional - Stock details.
- **qty** (integer) - Required - The quantity in stock.
- **is_in_stock** (boolean) - Required - Indicates if the item is in stock.
- **bundle_product_options** (array) - Optional - An array of bundle product options.
- **option_id** (integer) - Required - The ID of the option.
- **position** (integer) - Required - The position of the option.
- **sku** (string) - Required - The SKU of the option.
- **title** (string) - Required - The title of the option.
- **type** (string) - Required - The type of option (e.g., 'checkbox', 'radio').
- **required** (boolean) - Required - Indicates if the option is required.
- **product_links** (array) - Required - An array of linked products for the option.
- **sku** (string) - Required - The SKU of the linked product.
- **option_id** (integer) - Required - The ID of the option this product is linked to.
- **qty** (integer) - Required - The quantity of the linked product.
- **position** (integer) - Required - The position of the linked product.
- **is_default** (boolean) - Required - Indicates if this is the default linked product.
- **price** (float) - Required - The price of the linked product.
- **price_type** (integer) - Required - The price type (e.g., 0 for fixed).
- **can_change_quantity** (integer) - Required - Indicates if quantity can be changed.
- **custom_attributes** (array) - Optional - An array of custom attributes.
- **attribute_code** (string) - Required - The code of the custom attribute.
- **value** (string) - Required - The value of the custom attribute.
- **saveOptions** (boolean) - Required - Indicates whether to save the options.
### Request Example
```json
{
"product": {
"sku": "beginner-surfboard",
"name": "Beginner Surfboard",
"attribute_set_id": 4,
"status": 1,
"visibility": 4,
"type_id": "bundle",
"extension_attributes": {
"stock_item": {
"qty": 100,
"is_in_stock": true
},
"bundle_product_options": [
{
"option_id": 0,
"position": 1,
"sku": "surfboard-essentials",
"title": "Beginners 10ft Surfboard",
"type": "checkbox",
"required": true,
"product_links": [
{
"sku": "10-ft-beginner-surfboard",
"option_id": 1,
"qty": 1,
"position": 1,
"is_default": false,
"price": 100,
"price_type": 0,
"can_change_quantity": 0
}
]
},
{
"option_id": 1,
"position": 2,
"sku": "surboard-leash",
"title": "Surfboard leash",
"type": "checkbox",
"required": true,
"product_links": [
{
"sku": "8-ft-surboard-leash",
"option_id": 2,
"qty": 1,
"position": 1,
"is_default": false,
"price": 50,
"price_type": 0,
"can_change_quantity": 0
}
]
},
{
"option_id": 3,
"position": 2,
"sku": "surfboard-color",
"title": "Choose a color for the fins and fin plugs",
"type": "radio",
"required": true,
"product_links": [
{
"sku": "red-fins-and-fin-plugs",
"option_id": 2,
"qty": 1,
"position": 1,
"is_default": false,
"price": 0,
"price_type": 0,
"can_change_quantity": 0
},
{
"sku": "blue-fins-and-fin-plugs",
"option_id": 2,
"qty": 1,
"position": 2,
"is_default": false,
"price": 0,
"price_type": 0,
"can_change_quantity": 0
},
{
"sku": "yellow-fins-and-fin-plugs",
"option_id": 3,
"qty": 1,
"position": 3,
"is_default": false,
"price": 0,
"price_type": 0,
"can_change_quantity": 0
}
]
}
]
},
"custom_attributes": [
{
"attribute_code": "price_view",
"value": "0"
}
]
},
"saveOptions": true
}
```
### Response
#### Success Response (200)
- **product_id** (integer) - The ID of the created product.
- **sku** (string) - The SKU of the created product.
#### Response Example
```json
{
"id": 123,
"sku": "beginner-surfboard"
}
```
```
--------------------------------
### Initialize Production Repository with Composer and Git
Source: https://github.com/adobedocs/commerce-learn.en/blob/main/help/global-reference-architecture/monorepo.md
This snippet demonstrates initializing a production Adobe Commerce repository for a specific brand (Brand X) using Composer to create the project and Git for version control. It includes creating the directory, setting up the project, initializing Git, adding remote origin, committing initial files, and pushing to the remote repository.
```bash
mkdir gra-monorepo-brand-x
cd gra-monorepo-brand-x
composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition .
git init
git remote add origin git@github.com:AntonEvers/gra-monorepo-brand-x.git
git add composer.json composer.lock
git commit -m 'initialize Brand X repository'
git push -u origin main
```
--------------------------------
### Initialize GRA Foundation Git Repository
Source: https://github.com/adobedocs/commerce-learn.en/blob/main/help/global-reference-architecture/bulk-packages.md
Commands to create and initialize a Git repository for the shared GRA foundation code. This includes creating the directory, initializing Git, adding a remote origin, and making an initial commit.
```bash
mkdir gra-bulk-foundation
cd gra-bulk-foundation
git init
git remote add origin git@github.com:AntonEvers/gra-bulk-foundation.git
vim composer.json
git add composer.json
git commit -m 'initialize GRA foundation repository'
git push -u origin main
```
--------------------------------
### Get Configurable Product Details using cURL
Source: https://github.com/adobedocs/commerce-learn.en/blob/main/help/site-management/create-configurable-product.md
This GET request using cURL retrieves detailed information about a configurable product, including the linked IDs of its assigned child products. This is useful for verifying the associations after linking products.
```bash
curl --location '{{your.url.here}}/rest/default/V1/products/Kids-Hawaiian-Ukulele' \
--header 'Authorization: Bearer {{Your Bearer Token}}'
```
--------------------------------
### Get Children Associated with Configurable Product using cURL
Source: https://github.com/adobedocs/commerce-learn.en/blob/main/help/site-management/create-configurable-product.md
This GET request retrieves only the children associated with a specific configurable product. The response includes all attributes for each child product, such as SKU and price, allowing for a focused view of the child product data.
```bash
curl --location '{{your.url.here}}/rest/default/V1/configurable-products/kids-hawaiian-ukulele/children' \
--header 'Authorization: Bearer {{Your Bearer Token}}'
```
--------------------------------
### Get Grouped Product Information (cURL)
Source: https://github.com/adobedocs/commerce-learn.en/blob/main/help/site-management/create-grouped-product.md
This cURL command retrieves information about a specific grouped product. It uses a GET request to the products endpoint, providing the SKU of the grouped product. Authentication is required via a Bearer token.
```bash
curl --location '{{your.url.here}}rest/default/V1/products/some-grouped-product-sku' \
--header 'Authorization: Bearer {{Your Bearer Token}}' \
--header 'Cookie: private_content_version=3b797a6cc3c5c71f2193109fb9838b12'
```
--------------------------------
### Initialize Local Package Storage in Brand Repository
Source: https://github.com/adobedocs/commerce-learn.en/blob/main/help/global-reference-architecture/split-git.md
This command creates a 'packages/local' directory within the gra-split-brand-x repository and adds a .gitkeep file. This structure is used to store code that is specific to a single Adobe Commerce instance, ensuring it's managed locally within the brand repository.
```bash
cd ../gra-split-brand-x
mkdir -p packages/local
touch packages/local/.gitkeep
git add packages/local/.gitkeep
git commit -m 'initialize local package storage'
git push origin main
```