Questions tagged [create-product]

Denotes questions related to creating a product in magento

Filter by
Sorted by
Tagged with
0 votes
1 answer
17 views

Creating configurable product attribute with magento > 2.4

I wrote an extension to import products from an XML-file. It is working (for now), but I am using a ->save() method on the Class Magento\ConfigurableProduct\Model\Product\Type\Configurable\...
user avatar
  • 383
0 votes
2 answers
66 views

How I can create product programmatically using patch?

I must create SKU 2 and SKU 1 programmatically using a patch. How I can do that?
user avatar
  • 3
0 votes
0 answers
16 views

Magento2.4.3 Product create with images takes long time to save when ther is 3000+ products

I have a multistore website with 3000+ products, When I create a new product with images the product takes 17 - 35 seconds based on the number of images and their size. One image of size 54KB - 17 ...
user avatar
  • 434
0 votes
0 answers
15 views

Product create with image takes long time to save Magento2.4.3

When I create a simple product with a single image it takes 17 seconds to save, I have changed the indexing to schedule and removed all extensions and themes. On debugging further I can see that the ...
user avatar
  • 434
1 vote
2 answers
162 views

Magento 2: Create product using rest API image upload not working

I have creating product using rest API but image upload not working. API: baseurl/rest/V1/products Method: POST Body: { "product": { "sku": "info", "name&...
user avatar
  • 3,179
0 votes
2 answers
108 views

Magento 2 : Unable to generate Price for programmatically created 'custom product'

I have created a custom product for which I am able programmatically create products. The problem is that i am unable to generate a price for these products. the field is left blank when the product ...
user avatar
  • 429
1 vote
0 answers
1k views

Add custom attributes when creating product via REST API

I am attempting to set custom attributes when creating a new product via the REST API. The products have a required attribute hpUuid. This is part of my JSON file to create the new product: { "...
user avatar
1 vote
1 answer
60 views

Error Area Code is not set when Creating a virtual Product from Upgrade Schema

I'm using magento 2.2.5 , i want to make a virtual product programmatically using UpgradeSchema , but i alws got an error Upgrading data.. Area code is not set when i run bin/magento setup:upgrade ...
user avatar
  • 68
1 vote
1 answer
57 views

Magento2.3.0 Categories - I wish the products which are in child category will be visible in each parent category by default

I am using in Magento2.3.0 when i create product in admin side i need to Categories - I wish the products which are in child category will be visible in each parent category by default. adding the ...
user avatar
  • 1,597
0 votes
1 answer
195 views

Auto-expand subcategories in product form

I have a category with subcategories, and I want to have the subcategory visible from the beginning, when the user opens the category selector. Currently, the user has to click the arrow next to the ...
user avatar
  • 73
1 vote
1 answer
3k views

Magento 2 : When creating a product - Cannot add or update a child row: a foreign key constraint fails?

When creating a product, it throws this error SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`vbm`.`catalog_product_entity`, ...
user avatar
0 votes
0 answers
43 views

Cannot see products on homepage

I did the following: Logged into Admin Created a simple product Added a product list widget to the home page Reloaded cache ... And I cannot see my product displayed on the homepage.
user avatar
2 votes
0 answers
300 views

Magento REST API Cannot add products (Nonce and Invalid attribute SKU)

I'm new to Magento REST APIs. I've been trying to POST a product to my Magento store through Postman. OAuth 1.0 is authorized and I've checked it by updating a product and getting product details ...
user avatar
0 votes
1 answer
221 views

$product->save() taking 4 seconds to save one simple product in magento 2.1.3

I have below code with Image Upload which is working fine...but it takes 4 seconds to save one simple product....my store have more than 25000 products. It takes more than 4/5 hrs to create/update the ...
user avatar
0 votes
1 answer
648 views

Create virtual product programmatically

I'm using magento v2.5.5 to develop an extension, in this extension i have to generate virtual product with non manageble stock (infinite stock), how to do this programmatically, my virtual product ...
user avatar
2 votes
2 answers
5k views

Update product visibility Magento2

I am creating a product programmatically, trying to set the visibility with below code $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $product = $objectManager->create('\...
user avatar
  • 1,739
0 votes
0 answers
281 views

Create virtual product with custom options and dynamic price programmatically

How to create a virtual product programmatically and add custom option to it? And how to set the product price dynamic ?
user avatar
0 votes
1 answer
366 views

Magento 2 Programatically create a product on the checkout_cart_product_add_after event

I'm currently working on a module that adds specific products to the cart when the customer adds a normal product. I created an observer for the checkout_cart_product_add_after. The user will select a ...
user avatar
  • 1
1 vote
1 answer
427 views

Add stock data on product programatically in Magento 2

I want to add stock data on a product but it doesn't work. In my function, I have a product created by : $product = $objectManager->create('Magento\Catalog\Model\Product'); Then, I set some data ...
user avatar
  • 111
1 vote
0 answers
312 views

Magento2 create downloadable product into an iteration

i am trying to create downloadable products programmatically. The product data are saved into a xml file. The downloadable data are PDFs and not URLs. When only one xml file is into the data folder, ...
user avatar
0 votes
1 answer
325 views

add product programmatically magento 2: Undefined property: stdClass::$reference

I went to the backend of magento I added a reference attribute for product, then I executed the script Programmatically to add product I put: $_product->setName($product_data->_source->name);...
user avatar
0 votes
1 answer
3k views

Add product programmatically magento 2: Unique constraint violation found

I added this script to add several products, but it appears this error: Unique constraint violation found $countallproduct = count($allproduct); for ($item = 1; $item < $...
user avatar
0 votes
2 answers
2k views

Create Configurable Products in Magento 2 Programmatically

How to Create Configurable Products Programmatically in Magento 2? can anyone tell me about the solution to how to do this? Thanks
user avatar
0 votes
3 answers
3k views

Cannot add or update a child row: a foreign key constraint fails when creating product

I have the following code to create a product, but when I try to do it it throws me this exception: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint ...
user avatar
  • 166
1 vote
2 answers
625 views

Magento 2 : Error while adding product programatically On Observer Event `catalog_product_save_after`

I am trying to add product programmatically on catalog_product_save_after observer. Basically what i try to achieve is create a Duplicate Sample product of current product if PRODUCT-SKU-sample does ...
user avatar
1 vote
2 answers
526 views

Magento 2.1.5 How to create Module which can use Eav functionalities (addAttribute in my case)

I want to make module that creates magento products from xml file. So I have module with command php bin/magento LCB:import path/to/xml. It loads xml file with custom attributes which need to be ...
user avatar
  • 67
4 votes
5 answers
19k views

Magento 2 - Create product programmatically with different store view values

I have created this custom import module that will create products and set different values for each store view. The problem is, when I save a single attribute for the product on a store view, all the ...
user avatar
  • 751
1 vote
1 answer
140 views

Magento2: Product created from front-end is not adding to cart,it results "We can't add this item to your shopping cart right now."

However the sample products are adding in cart,this is problem with products that has been added programmatically. Below is the code I am using to create the product programmatically. $objectManager =...
user avatar
3 votes
1 answer
83 views

_save_after triggered before saving the product data in database

Intro: I'm a Python(Django) developer who is working at a company where we use Magento in the backend to sell products on our website. I'm not really experienced in Magento. We are using Magento ...
user avatar
3 votes
1 answer
3k views

Magento2 Create simple Product programmatically only works once

I have the following in our helper: public function __construct( \Magento\Framework\App\Helper\Context $context, \Magento\Catalog\Model\ResourceModel\Product\Collection $productCollection, ...
user avatar
  • 3,983
1 vote
1 answer
2k views

Create product using SOAP API and JSON input

I need to create product with SOAP API and JSON, here is my JSON input: {"sku":"tsett","name":"TEST","weight":"3.0000","qty":"18.0000","brand":"sample","category_ids":["107","108","109"],"pirce":"...
user avatar
1 vote
2 answers
3k views

"Invalid value for 'attribute'" (of type Yes/No) when creating product programmatically

When creating a product programmatically using the method described here, what format does the value need to be in for a Yes/No attribute type? (note: my attribute is global) So far I have tried the ...
user avatar
0 votes
1 answer
227 views

How to add product picture, in order to create bundle product programmatically

I need to create function that is creating bundle product, I already created my function and it works great, I mean its creating the bundle product for me, my problem is how can I add product's image, ...
user avatar
0 votes
1 answer
3k views

Add custom field (checkbox) in Products Create/Edit page in General Tab in Admin

I want to add a new checkbox labeled as "Featured" in create/edit products page in Magento Admin. This determines if a product is a featured product or not. These are my requirements : Add "...
user avatar
  • 159
1 vote
1 answer
771 views

admin create product, custom attribute validation limit to choose number between

I have custom product attribute called Donation, I created it by Catelog->Attribute->Manage-Attribute Add New Attribute. Their is no problem, Its working fine, But I need to add validation ...
user avatar
  • 3,036