Questions tagged [create-product]

Denotes questions related to creating a product in magento

Filter by
Sorted by
Tagged with
0 votes
1 answer
111 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\...
Mario's user avatar
  • 478
0 votes
2 answers
953 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?
tomk1v's user avatar
  • 13
1 vote
2 answers
358 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&...
Kirti Nariya's user avatar
  • 3,471
0 votes
2 answers
183 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 ...
theSeeker's user avatar
  • 449
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: { "...
dotancohen's user avatar
  • 1,115
1 vote
1 answer
93 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 ...
blue's user avatar
  • 128
1 vote
1 answer
81 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 ...
Rv Singh's user avatar
  • 1,617
0 votes
1 answer
253 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 ...
Dorni's user avatar
  • 73
1 vote
1 answer
4k 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.
somejkuser's user avatar
2 votes
0 answers
423 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 ...
Muhammad Adeel's user avatar
0 votes
1 answer
347 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 ...
Vrushabh Aeron's user avatar
0 votes
1 answer
703 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 ...
Tiny Dancer's user avatar
4 votes
2 answers
7k 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('\...
Jafar Pinjar's user avatar
  • 1,929
0 votes
0 answers
346 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 ?
Tiny Dancer's user avatar
0 votes
1 answer
462 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 ...
Filcp's user avatar
  • 1
1 vote
1 answer
523 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 ...
Erlaunis's user avatar
  • 111
1 vote
0 answers
332 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, ...
Balengou's user avatar
0 votes
1 answer
387 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
4k 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
Moin Malek's user avatar
0 votes
3 answers
4k 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 ...
Stordon's user avatar
  • 166
1 vote
2 answers
675 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 ...
JItendra Rana's user avatar
1 vote
2 answers
566 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 ...
mark's user avatar
  • 77
4 votes
5 answers
20k 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 ...
Robban's user avatar
  • 781
1 vote
1 answer
142 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 =...
Ranjeet Singh's user avatar
3 votes
1 answer
86 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 ...
anupsabraham's user avatar
3 votes
1 answer
4k 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, ...
tecjam's user avatar
  • 4,033
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":"...
vellai durai's user avatar
1 vote
2 answers
4k 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 ...
Gigilamesh's user avatar
0 votes
1 answer
247 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, ...
Saghi Ghorbani's 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 "...
Bogz's user avatar
  • 159
1 vote
1 answer
900 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 ...
Charlie's user avatar
  • 3,136