While saving product throws “Unable to save Stock Item” exception in magento 2.2.6
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
While saving product in backend,throws "Unable to save Stock Item".
I have tried after flushed the cache and reindexing but still exception throws.
I have reffered below link, but no luck
https://community.magento.com/t5/Magento-2-x-Technical-Issues/Cannot-add-products-in-Magento-2-1-11-quot-Unable-to-save-Stock/td-p/108369
In exception log throws
[2019-04-09 11:04:50] main.CRITICAL: Unable to save Stock Item
{"exception":"[object]
(MagentoFrameworkExceptionCouldNotSaveException(code: 0): Unable
to save Stock Item at
/var/www/html/vega/vendor/magento/module-catalog-inventory/Model/Stock/StockItemRepository.php:183,
Zend_Db_Statement_Exception(code: 23000): SQLSTATE[23000]: Integrity
constraint violation: 1452 Cannot add or update a child row: a foreign
key constraint fails (vega
.cataloginventory_stock_item
, CONSTRAINT
CATINV_STOCK_ITEM_STOCK_ID_CATINV_STOCK_STOCK_ID
FOREIGN KEY
(stock_id
) REFERENCEScataloginventory_stock
(stock_id
) ON
DELETE CASCADE), query was: INSERT INTOcataloginventory_stock_item
(product_id
,stock_id
,qty
,min_qty
,use_config_min_qty
,
is_qty_decimal
,backorders
,use_config_backorders
,
min_sale_qty
,use_config_min_sale_qty
,max_sale_qty
,
use_config_max_sale_qty
,is_in_stock
,low_stock_date
,
notify_stock_qty
,use_config_notify_stock_qty
,manage_stock
,
use_config_manage_stock
,stock_status_changed_auto
,
use_config_qty_increments
,qty_increments
,
use_config_enable_qty_inc
,enable_qty_increments
,
is_decimal_divided
,website_id
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) at
/var/www/html/vega/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:235,
PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint
violation: 1452 Cannot add or update a child row: a foreign key
constraint fails (vega
.cataloginventory_stock_item
, CONSTRAINT
CATINV_STOCK_ITEM_STOCK_ID_CATINV_STOCK_STOCK_ID
FOREIGN KEY
(stock_id
) REFERENCEScataloginventory_stock
(stock_id
) ON
DELETE CASCADE) at
/var/www/html/vega/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:228)"}
product backend magento2.2.6 stock save
|
show 5 more comments
While saving product in backend,throws "Unable to save Stock Item".
I have tried after flushed the cache and reindexing but still exception throws.
I have reffered below link, but no luck
https://community.magento.com/t5/Magento-2-x-Technical-Issues/Cannot-add-products-in-Magento-2-1-11-quot-Unable-to-save-Stock/td-p/108369
In exception log throws
[2019-04-09 11:04:50] main.CRITICAL: Unable to save Stock Item
{"exception":"[object]
(MagentoFrameworkExceptionCouldNotSaveException(code: 0): Unable
to save Stock Item at
/var/www/html/vega/vendor/magento/module-catalog-inventory/Model/Stock/StockItemRepository.php:183,
Zend_Db_Statement_Exception(code: 23000): SQLSTATE[23000]: Integrity
constraint violation: 1452 Cannot add or update a child row: a foreign
key constraint fails (vega
.cataloginventory_stock_item
, CONSTRAINT
CATINV_STOCK_ITEM_STOCK_ID_CATINV_STOCK_STOCK_ID
FOREIGN KEY
(stock_id
) REFERENCEScataloginventory_stock
(stock_id
) ON
DELETE CASCADE), query was: INSERT INTOcataloginventory_stock_item
(product_id
,stock_id
,qty
,min_qty
,use_config_min_qty
,
is_qty_decimal
,backorders
,use_config_backorders
,
min_sale_qty
,use_config_min_sale_qty
,max_sale_qty
,
use_config_max_sale_qty
,is_in_stock
,low_stock_date
,
notify_stock_qty
,use_config_notify_stock_qty
,manage_stock
,
use_config_manage_stock
,stock_status_changed_auto
,
use_config_qty_increments
,qty_increments
,
use_config_enable_qty_inc
,enable_qty_increments
,
is_decimal_divided
,website_id
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) at
/var/www/html/vega/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:235,
PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint
violation: 1452 Cannot add or update a child row: a foreign key
constraint fails (vega
.cataloginventory_stock_item
, CONSTRAINT
CATINV_STOCK_ITEM_STOCK_ID_CATINV_STOCK_STOCK_ID
FOREIGN KEY
(stock_id
) REFERENCEScataloginventory_stock
(stock_id
) ON
DELETE CASCADE) at
/var/www/html/vega/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:228)"}
product backend magento2.2.6 stock save
You imported product via csv?
– Jugal Kishor
yesterday
yes, I imported via csv
– Jaisa
yesterday
I have truncated the tables which is menioned in the above link, afer that i have tried to import products via csv. Now products are saved without quanity
– Jaisa
yesterday
product have custom options?
– Jugal Kishor
yesterday
Have you tried reindex command?
– Amit Naraniwal
yesterday
|
show 5 more comments
While saving product in backend,throws "Unable to save Stock Item".
I have tried after flushed the cache and reindexing but still exception throws.
I have reffered below link, but no luck
https://community.magento.com/t5/Magento-2-x-Technical-Issues/Cannot-add-products-in-Magento-2-1-11-quot-Unable-to-save-Stock/td-p/108369
In exception log throws
[2019-04-09 11:04:50] main.CRITICAL: Unable to save Stock Item
{"exception":"[object]
(MagentoFrameworkExceptionCouldNotSaveException(code: 0): Unable
to save Stock Item at
/var/www/html/vega/vendor/magento/module-catalog-inventory/Model/Stock/StockItemRepository.php:183,
Zend_Db_Statement_Exception(code: 23000): SQLSTATE[23000]: Integrity
constraint violation: 1452 Cannot add or update a child row: a foreign
key constraint fails (vega
.cataloginventory_stock_item
, CONSTRAINT
CATINV_STOCK_ITEM_STOCK_ID_CATINV_STOCK_STOCK_ID
FOREIGN KEY
(stock_id
) REFERENCEScataloginventory_stock
(stock_id
) ON
DELETE CASCADE), query was: INSERT INTOcataloginventory_stock_item
(product_id
,stock_id
,qty
,min_qty
,use_config_min_qty
,
is_qty_decimal
,backorders
,use_config_backorders
,
min_sale_qty
,use_config_min_sale_qty
,max_sale_qty
,
use_config_max_sale_qty
,is_in_stock
,low_stock_date
,
notify_stock_qty
,use_config_notify_stock_qty
,manage_stock
,
use_config_manage_stock
,stock_status_changed_auto
,
use_config_qty_increments
,qty_increments
,
use_config_enable_qty_inc
,enable_qty_increments
,
is_decimal_divided
,website_id
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) at
/var/www/html/vega/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:235,
PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint
violation: 1452 Cannot add or update a child row: a foreign key
constraint fails (vega
.cataloginventory_stock_item
, CONSTRAINT
CATINV_STOCK_ITEM_STOCK_ID_CATINV_STOCK_STOCK_ID
FOREIGN KEY
(stock_id
) REFERENCEScataloginventory_stock
(stock_id
) ON
DELETE CASCADE) at
/var/www/html/vega/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:228)"}
product backend magento2.2.6 stock save
While saving product in backend,throws "Unable to save Stock Item".
I have tried after flushed the cache and reindexing but still exception throws.
I have reffered below link, but no luck
https://community.magento.com/t5/Magento-2-x-Technical-Issues/Cannot-add-products-in-Magento-2-1-11-quot-Unable-to-save-Stock/td-p/108369
In exception log throws
[2019-04-09 11:04:50] main.CRITICAL: Unable to save Stock Item
{"exception":"[object]
(MagentoFrameworkExceptionCouldNotSaveException(code: 0): Unable
to save Stock Item at
/var/www/html/vega/vendor/magento/module-catalog-inventory/Model/Stock/StockItemRepository.php:183,
Zend_Db_Statement_Exception(code: 23000): SQLSTATE[23000]: Integrity
constraint violation: 1452 Cannot add or update a child row: a foreign
key constraint fails (vega
.cataloginventory_stock_item
, CONSTRAINT
CATINV_STOCK_ITEM_STOCK_ID_CATINV_STOCK_STOCK_ID
FOREIGN KEY
(stock_id
) REFERENCEScataloginventory_stock
(stock_id
) ON
DELETE CASCADE), query was: INSERT INTOcataloginventory_stock_item
(product_id
,stock_id
,qty
,min_qty
,use_config_min_qty
,
is_qty_decimal
,backorders
,use_config_backorders
,
min_sale_qty
,use_config_min_sale_qty
,max_sale_qty
,
use_config_max_sale_qty
,is_in_stock
,low_stock_date
,
notify_stock_qty
,use_config_notify_stock_qty
,manage_stock
,
use_config_manage_stock
,stock_status_changed_auto
,
use_config_qty_increments
,qty_increments
,
use_config_enable_qty_inc
,enable_qty_increments
,
is_decimal_divided
,website_id
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) at
/var/www/html/vega/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:235,
PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint
violation: 1452 Cannot add or update a child row: a foreign key
constraint fails (vega
.cataloginventory_stock_item
, CONSTRAINT
CATINV_STOCK_ITEM_STOCK_ID_CATINV_STOCK_STOCK_ID
FOREIGN KEY
(stock_id
) REFERENCEScataloginventory_stock
(stock_id
) ON
DELETE CASCADE) at
/var/www/html/vega/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:228)"}
product backend magento2.2.6 stock save
product backend magento2.2.6 stock save
edited yesterday
Jaisa
asked yesterday
JaisaJaisa
8941939
8941939
You imported product via csv?
– Jugal Kishor
yesterday
yes, I imported via csv
– Jaisa
yesterday
I have truncated the tables which is menioned in the above link, afer that i have tried to import products via csv. Now products are saved without quanity
– Jaisa
yesterday
product have custom options?
– Jugal Kishor
yesterday
Have you tried reindex command?
– Amit Naraniwal
yesterday
|
show 5 more comments
You imported product via csv?
– Jugal Kishor
yesterday
yes, I imported via csv
– Jaisa
yesterday
I have truncated the tables which is menioned in the above link, afer that i have tried to import products via csv. Now products are saved without quanity
– Jaisa
yesterday
product have custom options?
– Jugal Kishor
yesterday
Have you tried reindex command?
– Amit Naraniwal
yesterday
You imported product via csv?
– Jugal Kishor
yesterday
You imported product via csv?
– Jugal Kishor
yesterday
yes, I imported via csv
– Jaisa
yesterday
yes, I imported via csv
– Jaisa
yesterday
I have truncated the tables which is menioned in the above link, afer that i have tried to import products via csv. Now products are saved without quanity
– Jaisa
yesterday
I have truncated the tables which is menioned in the above link, afer that i have tried to import products via csv. Now products are saved without quanity
– Jaisa
yesterday
product have custom options?
– Jugal Kishor
yesterday
product have custom options?
– Jugal Kishor
yesterday
Have you tried reindex command?
– Amit Naraniwal
yesterday
Have you tried reindex command?
– Amit Naraniwal
yesterday
|
show 5 more comments
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f269362%2fwhile-saving-product-throws-unable-to-save-stock-item-exception-in-magento-2-2%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f269362%2fwhile-saving-product-throws-unable-to-save-stock-item-exception-in-magento-2-2%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You imported product via csv?
– Jugal Kishor
yesterday
yes, I imported via csv
– Jaisa
yesterday
I have truncated the tables which is menioned in the above link, afer that i have tried to import products via csv. Now products are saved without quanity
– Jaisa
yesterday
product have custom options?
– Jugal Kishor
yesterday
Have you tried reindex command?
– Amit Naraniwal
yesterday