Products or services are the items you sell in your store. For a user, it is important to get not only clear but detailed information about the product, shipping, and delivery. This guide will help you to get through the questions on how to work with products from the admin and programmatically.

How to Add New Product in Magento Admin Panel

Step 1: Log-in to the Magento Admin panel.

Magento Admin Panel

Step 2: Click “Catalog” option on the top menu. A drop-down list will appear.

Catalog Section

Step 3: Click “Products” in the drop-down list. A new window will be displayed.

Products Section

Step 4: Click the “Add Product” button on the top-right of the page, also, you can immediately choose a type for your product. You will be directed to a new window.

Product Types Options

Step 5: Here, you will notice a header with “New Product” with 2 buttons “Add attribute,” “Save,” and many fields, you must fill them. Initially the field “Attribute Type” shows “Default” in the text box next to it. And “Product Type” field shows “Simple Product.”

Step 7: Now to modify the options in the text box of the field “Product Type,” click the “drop-down arrow” at the end of the text box to view the multiple drop-down options like Simple Product, Grouped Product, Configurable Product, Virtual Product, Bundle Product, and Downloadable Product. Select the one you wish to add. For instance, say “Simple Product” selected.

Step 8: Click “Continue” button. A new product page with default attribute opens up.

New Product Page

You’ll find a header “General” below which different fields like Name, Description, Short Description, SKU, Weight, Set Product as New From Date, Set Product as New To Date, Status, URL Key, Visibility, Country of Manufacture, In Feed, and Featured Product with their empty fields will appear.

Step 10: Now, enter the name of the product in the “Name” field. Say XYZ.

Product Name

Step 11: Click “Save and Continue Edit” button on the top-right corner of the page to save the details automatically. Now continue entering the details in rest of the fields.

Step 12: Select the option “Enabled” in the drop-down of the field “Status.”

Step 13: Ensure whether the visibility field is filled in with “Visibility, Search” option.

Visibility on Catalog,Search

Step 14: Now click the “Search Engine Optimization” on the LHS of the panel.

SEO Optimization Settings

Step 15: Add Meta titles, descriptions, and keywords in the necessary fields respectively.

Step 16: Click “Images And Videos ” option on the LHS of the panel to add images for the product.

Image and Videos Settings

Step 17: Click “Advanced Inventory” option on the LHS of the panel. A new page will be opened.

Advanced Inventory Settings

Step 18: Modify the “Qty” with the number of products in-stock, say 200 or 300 and set the “Availability” option at the bottom of the page as “in-stock.”

Selecting the Category

Step 20: Click “Prices” on the LHS of the main panel; set the necessary price-related details in the relevant fields.

Pricing Settings

Step 21: Use this section in Magento to add configurable product. The new page contains advanced settings.

Create Product Configurations

That’s all you are done with adding a product to your website! All it takes just a few minutes to add a compelling product to the Magento store to raise the performance of your business. Next, we will consider how to do the same task programmatically.

How to Add Product to Cart in Magento Programmatically?

Add Product to cart by observing an event checkout_cart_product_add_after

<your_magento_directory>/app/code/JD/Floatcart/Observer/AddproductToCart.php :

namespace JD\Floatcart\Observer;


class AddproductToCart implements \Magento\Framework\Event\ObserverInterface{

   protected $_productRepository;
   protected $_cart;
   protected $formKey;

   public function __construct(\Magento\Catalog\Model\ProductRepository $productRepository, \Magento\Checkout\Model\Cart $cart, \Magento\Framework\Data\Form\FormKey $formKey)
   {
       $this->_productRepository = $productRepository;
       $this->_cart = $cart;
       $this->formKey = $formKey;
   }
   public function execute(\Magento\Framework\Event\Observer $observer)
   {
       $item = $observer->getEvent()->getData('quote_item');
       $product = $observer->getEvent()->getData('product');
       $item = ($item->getParentItem() ? $item->getParentItem() : $item);

       //id product that you want add to cart
       $product_id=1023;

       if($product->getId() != $product_id){
           $params = array(
               'product' => $product_id,
               'qty' => $product->getQty()
           );
           $_product = $this->_productRepository->getById($product_id);
           $this->_cart->addProduct($_product,$params);
           $this->_cart->save();
       }

   }

}

To <your_magento_directory>/app/code/JD/Floatcart/etc/events.xml you need add code as this:

<event name="checkout_cart_product_add_after">
   <observer name="addproduct_tocart" instance="JD\Floatcart\Observer\AddproductToCart"/>
</event>

That’s how in Magento you add item to cart programmatically. Next useful skill is to learn how to create products from the admin.

How to Create Simple Products in Magento 2

Step 1: Choose the Product Type.

  • On the Admin sidebar, click Products. Then under Inventory, select Catalog.
  • In the upper-right corner on the Add Product menu, select Simple Product.

Add Product menu

Step 2: Choose the Product Template (Optional).

To choose the product template, do one of the following:

  • In the Search box, enter the name of the template.
  • In the list, choose the template that you will use. The form is updated to reflect the template.

New Product Page

Step 3: Complete the Required Fields.

In the Product Details section do the following:

  • Enter the Product Name.
  • You can either use the default SKU that is based on the product name or enter another.
  • Enter the product Price.

Because the product is not yet ready to publish, set the Product Online switch to the “Off” position.

Click Save, and continue with the next step. You can save the product settings after complete all the required fields complete.

Step 4: Complete the Remaining Product Details.

Set Tax Class to one of the following:

  • None
  • Taxable Goods

If you’re ready to add a product image, do one of the following:

  • Drag an image from your desktop, and drop it on the camera tile in the Images and Videos.
  • In the Images box, click the camera tile, and navigate to the image file on your computer.

Then, select the image, and click Open. A placeholder appears until a product image is uploaded.

Enter the Quantity of the product that is currently in stock.

Enter the product Weight.

To assign the product to a Category, do one of the following:

  • Start typing to find a match. Then, choose the Category.
  • Click Show List to see the category tree. Then, drill down and click on each category that you want to assign to the product.
  • Click New Category. Enter the Category Name and choose the Parent Category to determine its position in the menu structure. Then, click Create Category.

Create Category

Enter the product Description directly into the text box, and format as needed. Then, click Submit. You can also use the WYSIWYG Editor, for additional control.

New Product

Step 5: Publish the Product.

If you are ready to publish the product in the catalog, set the Product Online switch to the “On” position. When complete, on the Save menu, select Save & Close.

Step 6: View the Product in Your Store.

In the upper-right corner on the Admin menu, select Customer View

Customer View

Things to remember:

  • Simple products can be included in a configurable, bundle, and grouped product types.
  • A simple product can have custom options with a variety of input controls, which makes it possible to sell many product variations from a single SKU.

How to Import Products in Magento 1.x from CSV?

Step 1: Go to the Magento administrator area and choose System -> Import/Export -> Dataflow – Profiles -> Import All Products. Select the required settings in Profile Wizard tab:

Import All Products

Step 2: Then choose the Upload File tab and browse for the .csv file on your computer.

Save changes:

Saving Changes

Step 3: Once you have uploaded it, click Import All Products, then Run Profile, select the .csv file you have just uploaded from the drop-down menu and click Run Profile in Popup:

Run Profile in Popup

Step 4: When the import is completed, you will get an export success message.

What Is Magento Bundle Product?

This type of Magento products is somewhat a set of configurable products. It is a stable complex product designed to let customers build the end product required. The configuration options are virtually unlimited.

How to Create Bundle Product in Magento 2?

Step 1: Select the Product Type by selecting Catalog -> Products.

Catalog -> Products

Next, create Bundle Product.

Bundle Product

Step 2. Choose the attribute set as a template.

Choosing the Attribute Set

Fill out the required fields:

  • Product Name;
  • SKU (default or change the Dynamic SKU to No so that you can assign a unique SKU);
  • Dynamic Price (to do the same as with SKU, change Dynamic Price to No, and write your price);
  • Choose the Store view where the product should appear;
  • Tap Save and continue.

You can also assign a Tax class. If the bundle has Fixed price you have 2 options:

  • None
  • Taxable Goods

The Quantity is not available as the value is different for each bundled product.

Dynamic weight can be changed according to the options provided for the customer.

  • If you choose the Dynamic option, the price may change according to the selected options.
  • If you choose Fixed weight, you need to set the weight.

Next, you want to create a Category.

Tap New Category or choose the one that it is already set.

New Category

Write the Category Name and assign it to the Parent Category, next click on Create Category.

Category Name

Add product description and a picture.

Step 3. Set the Bundle Items.
In the Bundle Items section, choose how to Ship Bundle Items: Separately or Together.
Then click on the Add option.

Bundle Items Menu

There you will find the Input Type and choose the one among Drop-down, Radio buttons, Checkbox, or Multiple Select.

Then click Add Products to Option and mark all the products that you want to include.

Type the Quantity of each product on the Default Quantity section.

Then press Save.

Step 7. Check the results by clicking to the Admin Icon and choose the Customer View.

Choose Customer View

Bundle Products - Store View

Here is the result of the product bundle feature in Magento 2. It is very useful for the stores that want to sell different products together in one kit. In general, we wanted to help you learn how to create products and manage them from the admin panel. If you want to know how to do it, follow the extended instruction below.

5.00 / 5.0
Article rating (9 Reviews)
Do you find this article useful? Please, let us know your opinion and rate the post!
Not badGoodVery GoodGreatAwesome