Check products in cart if they are out of stock before place order REST API : Magento 2is it possible to...
Getting the || sign while using Kurier
Why is gluten-free baking possible?
Specifying a starting column with colortbl package and xcolor
What's the 'present simple' form of the word "нашла́" in 3rd person singular female?
Recommendation letter by significant other if you worked with them professionally?
For which categories of spectra is there an explicit description of the fibrant objects via lifting properties?
Why does cron require MTA for logging?
Create chunks from an array
What materials can be used to make a humanoid skin warm?
Does "Until when" sound natural for native speakers?
Can I negotiate a patent idea for a raise, under French law?
Is it safe to abruptly remove Arduino power?
In the late 1940’s to early 1950’s what technology was available that could melt a LOT of ice?
Is this Paypal Github SDK reference really a dangerous site?
Can one live in the U.S. and not use a credit card?
How to resolve: Reviewer #1 says remove section X vs. Reviewer #2 says expand section X
MySQL importing CSV files really slow
Is it a Cyclops number? "Nobody" knows!
What is better: yes / no radio, or simple checkbox?
Which situations would cause a company to ground or recall a aircraft series?
How can I manipulate the output of Information?
Plausibility of Mushroom Buildings
Signed and unsigned numbers
Called into a meeting and told we are being made redundant (laid off) and "not to share outside". Can I tell my partner?
Check products in cart if they are out of stock before place order REST API : Magento 2
is it possible to create mobile app using the rest api / or soap?Products are OUT OF STOCKMagento2 REST API products list and out of stockPlace order using Magento Rest API - IssueMagento 2 Bug | Customer Places Order in Cart, then out of stock when checking outMagento 2 rest api: Ignore out of stock products in get products search criteriaIn stock, freshly uploaded product showing out of stock on frontend - Magento 2Displaying last bought quantity by current customer in product view page0 item price in cart when add to cart after place orderbefore place order checkout stock by remote api
I am building mobile application using Magento 2
, I had an old defined cart which had a product and when checking out it gives an error saying the item is out of stock
, that happened after payment and placing the order. I checked this product in backend and found its Quantity was 0 and out of stock
. checked with my friend and knew that he bought it in a test case.
Ho can I fix this problem and check all products in cart are in stock OR out of stock Using REST API?
magento2 checkout api rest out-of-stock
bumped to the homepage by Community♦ 3 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I am building mobile application using Magento 2
, I had an old defined cart which had a product and when checking out it gives an error saying the item is out of stock
, that happened after payment and placing the order. I checked this product in backend and found its Quantity was 0 and out of stock
. checked with my friend and knew that he bought it in a test case.
Ho can I fix this problem and check all products in cart are in stock OR out of stock Using REST API?
magento2 checkout api rest out-of-stock
bumped to the homepage by Community♦ 3 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I am building mobile application using Magento 2
, I had an old defined cart which had a product and when checking out it gives an error saying the item is out of stock
, that happened after payment and placing the order. I checked this product in backend and found its Quantity was 0 and out of stock
. checked with my friend and knew that he bought it in a test case.
Ho can I fix this problem and check all products in cart are in stock OR out of stock Using REST API?
magento2 checkout api rest out-of-stock
I am building mobile application using Magento 2
, I had an old defined cart which had a product and when checking out it gives an error saying the item is out of stock
, that happened after payment and placing the order. I checked this product in backend and found its Quantity was 0 and out of stock
. checked with my friend and knew that he bought it in a test case.
Ho can I fix this problem and check all products in cart are in stock OR out of stock Using REST API?
magento2 checkout api rest out-of-stock
magento2 checkout api rest out-of-stock
asked Feb 1 '18 at 9:05
Jsparo30Jsparo30
6491626
6491626
bumped to the homepage by Community♦ 3 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 3 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I am not sure I understand your question but you can add a new extension attributes that check stock status in rest/V1/carts/mine/items
and display the appropriate message.
Create your extension attribute in Vendor/ModuleName/etc/webapi_rest/extension_attributes.xml
<extension_attributes for="MagentoQuoteApiDataCartItemInterface">
<attribute code="stock" type="string" />
</extension_attributes>
Then Create your plugin to overwrite MagentoQuoteModelQuoteItemRepository::getList
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoQuoteModelQuoteItemRepository">
<plugin name="stock" type="VendorModuleNamePluginStock" disabled="false" sortOrder="70"/>
</type>
</config>
Then Create Stock.php in VendorModuleNamePluginStock.php
In Stock.php, we overwrite GetList with aroundplugin. We also get StockRegistryInterface to check If item is in stock by sku. Then we pass the message to our extension interface factory.
<?php
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace VendorModuleNamePlugin;
use MagentoQuoteModelQuoteItemRepository as ItemRepository;
class Stock
{
protected $quoteRepository;
protected $cartItemExtensionFactory;
protected $stockRegistry;
public function __construct(
MagentoQuoteApiCartRepositoryInterface $quoteRepository,
MagentoQuoteApiDataCartItemExtensionFactory $cartItemExtensionFactory,
MagentoCatalogInventoryApiStockRegistryInterface $stockRegistry
) {
$this->quoteRepository = $quoteRepository;
$this->stockRegistry = $stockRegistry;
$this->cartItemExtensionFactory = $cartItemExtensionFactory;
}
public function aroundGetList(ItemRepository $subject, Closure $proceed, $cartId)
{
$cartItems = $proceed($cartId);
/** @var MagentoQuoteModelQuote $quote */
$quote = $this->quoteRepository->getActive($cartId);
/** @var MagentoQuoteApiDataCartItemExtensionInterface $extensionAttributes */
$i = 0;
foreach ($quote->getAllVisibleItems() as $item) {
$extensionAttributes = $cartItems[$i]->getExtensionAttributes();
if ($extensionAttributes === null) {
$extensionAttributes = $this->cartItemExtensionFactory->create();
}
$sku = $item->getSku();
$stock = $this->stockRegistry->getStockItemBySku($sku)->getIsInStock();
if ($stock) {
$message = "Item In Stock";
} else {
$message = "Item Out Of Stock";
}
$extensionAttributes->setStock($message);
$cartItems[$i]->setExtensionAttributes($extensionAttributes);
$i++;
}
// $cartItems->setExtensionAttributes($extensionAttributes);
return $cartItems;
}
}
Thanks
i think we can use a boolean flag <attribute code="stock" type="boolean" /> if ($stock) { $message = true; } else { $message = false; }
– sivakumar
Jun 27 '18 at 13:30
Thanks @sivakumar. Boolean is obviously better. But this still return a string of "0" and "1". Any reason for this??
– Soladogun Ilyas Ademuyiwa
Jun 28 '18 at 5:51
This code give error :Fatal error</b>: Uncaught Error: Call to undefined method MagentoQuoteApiDataCartItemExtension::setStock() in /Vendor/CheckStock/Plugin/Stock.php:46 @SoladogunIlyasAdemuyiwa
– Lovely Setia
Dec 5 '18 at 9:50
@LovelySetia Make sure you recompile. It should generate that attribute setStock in the generated folder since attribute code is stock
– Soladogun Ilyas Ademuyiwa
Dec 6 '18 at 11:01
I will deleted var/generation/*,var/page_cache/*,var/cache/*.After that run Setup:upgrade,setup:di:compile,setup:static-content:deploy commands.It still showing error @SoladogunIlyasAdemuyiwa
– Lovely Setia
Dec 6 '18 at 14:24
|
show 4 more comments
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%2f211823%2fcheck-products-in-cart-if-they-are-out-of-stock-before-place-order-rest-api-ma%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I am not sure I understand your question but you can add a new extension attributes that check stock status in rest/V1/carts/mine/items
and display the appropriate message.
Create your extension attribute in Vendor/ModuleName/etc/webapi_rest/extension_attributes.xml
<extension_attributes for="MagentoQuoteApiDataCartItemInterface">
<attribute code="stock" type="string" />
</extension_attributes>
Then Create your plugin to overwrite MagentoQuoteModelQuoteItemRepository::getList
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoQuoteModelQuoteItemRepository">
<plugin name="stock" type="VendorModuleNamePluginStock" disabled="false" sortOrder="70"/>
</type>
</config>
Then Create Stock.php in VendorModuleNamePluginStock.php
In Stock.php, we overwrite GetList with aroundplugin. We also get StockRegistryInterface to check If item is in stock by sku. Then we pass the message to our extension interface factory.
<?php
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace VendorModuleNamePlugin;
use MagentoQuoteModelQuoteItemRepository as ItemRepository;
class Stock
{
protected $quoteRepository;
protected $cartItemExtensionFactory;
protected $stockRegistry;
public function __construct(
MagentoQuoteApiCartRepositoryInterface $quoteRepository,
MagentoQuoteApiDataCartItemExtensionFactory $cartItemExtensionFactory,
MagentoCatalogInventoryApiStockRegistryInterface $stockRegistry
) {
$this->quoteRepository = $quoteRepository;
$this->stockRegistry = $stockRegistry;
$this->cartItemExtensionFactory = $cartItemExtensionFactory;
}
public function aroundGetList(ItemRepository $subject, Closure $proceed, $cartId)
{
$cartItems = $proceed($cartId);
/** @var MagentoQuoteModelQuote $quote */
$quote = $this->quoteRepository->getActive($cartId);
/** @var MagentoQuoteApiDataCartItemExtensionInterface $extensionAttributes */
$i = 0;
foreach ($quote->getAllVisibleItems() as $item) {
$extensionAttributes = $cartItems[$i]->getExtensionAttributes();
if ($extensionAttributes === null) {
$extensionAttributes = $this->cartItemExtensionFactory->create();
}
$sku = $item->getSku();
$stock = $this->stockRegistry->getStockItemBySku($sku)->getIsInStock();
if ($stock) {
$message = "Item In Stock";
} else {
$message = "Item Out Of Stock";
}
$extensionAttributes->setStock($message);
$cartItems[$i]->setExtensionAttributes($extensionAttributes);
$i++;
}
// $cartItems->setExtensionAttributes($extensionAttributes);
return $cartItems;
}
}
Thanks
i think we can use a boolean flag <attribute code="stock" type="boolean" /> if ($stock) { $message = true; } else { $message = false; }
– sivakumar
Jun 27 '18 at 13:30
Thanks @sivakumar. Boolean is obviously better. But this still return a string of "0" and "1". Any reason for this??
– Soladogun Ilyas Ademuyiwa
Jun 28 '18 at 5:51
This code give error :Fatal error</b>: Uncaught Error: Call to undefined method MagentoQuoteApiDataCartItemExtension::setStock() in /Vendor/CheckStock/Plugin/Stock.php:46 @SoladogunIlyasAdemuyiwa
– Lovely Setia
Dec 5 '18 at 9:50
@LovelySetia Make sure you recompile. It should generate that attribute setStock in the generated folder since attribute code is stock
– Soladogun Ilyas Ademuyiwa
Dec 6 '18 at 11:01
I will deleted var/generation/*,var/page_cache/*,var/cache/*.After that run Setup:upgrade,setup:di:compile,setup:static-content:deploy commands.It still showing error @SoladogunIlyasAdemuyiwa
– Lovely Setia
Dec 6 '18 at 14:24
|
show 4 more comments
I am not sure I understand your question but you can add a new extension attributes that check stock status in rest/V1/carts/mine/items
and display the appropriate message.
Create your extension attribute in Vendor/ModuleName/etc/webapi_rest/extension_attributes.xml
<extension_attributes for="MagentoQuoteApiDataCartItemInterface">
<attribute code="stock" type="string" />
</extension_attributes>
Then Create your plugin to overwrite MagentoQuoteModelQuoteItemRepository::getList
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoQuoteModelQuoteItemRepository">
<plugin name="stock" type="VendorModuleNamePluginStock" disabled="false" sortOrder="70"/>
</type>
</config>
Then Create Stock.php in VendorModuleNamePluginStock.php
In Stock.php, we overwrite GetList with aroundplugin. We also get StockRegistryInterface to check If item is in stock by sku. Then we pass the message to our extension interface factory.
<?php
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace VendorModuleNamePlugin;
use MagentoQuoteModelQuoteItemRepository as ItemRepository;
class Stock
{
protected $quoteRepository;
protected $cartItemExtensionFactory;
protected $stockRegistry;
public function __construct(
MagentoQuoteApiCartRepositoryInterface $quoteRepository,
MagentoQuoteApiDataCartItemExtensionFactory $cartItemExtensionFactory,
MagentoCatalogInventoryApiStockRegistryInterface $stockRegistry
) {
$this->quoteRepository = $quoteRepository;
$this->stockRegistry = $stockRegistry;
$this->cartItemExtensionFactory = $cartItemExtensionFactory;
}
public function aroundGetList(ItemRepository $subject, Closure $proceed, $cartId)
{
$cartItems = $proceed($cartId);
/** @var MagentoQuoteModelQuote $quote */
$quote = $this->quoteRepository->getActive($cartId);
/** @var MagentoQuoteApiDataCartItemExtensionInterface $extensionAttributes */
$i = 0;
foreach ($quote->getAllVisibleItems() as $item) {
$extensionAttributes = $cartItems[$i]->getExtensionAttributes();
if ($extensionAttributes === null) {
$extensionAttributes = $this->cartItemExtensionFactory->create();
}
$sku = $item->getSku();
$stock = $this->stockRegistry->getStockItemBySku($sku)->getIsInStock();
if ($stock) {
$message = "Item In Stock";
} else {
$message = "Item Out Of Stock";
}
$extensionAttributes->setStock($message);
$cartItems[$i]->setExtensionAttributes($extensionAttributes);
$i++;
}
// $cartItems->setExtensionAttributes($extensionAttributes);
return $cartItems;
}
}
Thanks
i think we can use a boolean flag <attribute code="stock" type="boolean" /> if ($stock) { $message = true; } else { $message = false; }
– sivakumar
Jun 27 '18 at 13:30
Thanks @sivakumar. Boolean is obviously better. But this still return a string of "0" and "1". Any reason for this??
– Soladogun Ilyas Ademuyiwa
Jun 28 '18 at 5:51
This code give error :Fatal error</b>: Uncaught Error: Call to undefined method MagentoQuoteApiDataCartItemExtension::setStock() in /Vendor/CheckStock/Plugin/Stock.php:46 @SoladogunIlyasAdemuyiwa
– Lovely Setia
Dec 5 '18 at 9:50
@LovelySetia Make sure you recompile. It should generate that attribute setStock in the generated folder since attribute code is stock
– Soladogun Ilyas Ademuyiwa
Dec 6 '18 at 11:01
I will deleted var/generation/*,var/page_cache/*,var/cache/*.After that run Setup:upgrade,setup:di:compile,setup:static-content:deploy commands.It still showing error @SoladogunIlyasAdemuyiwa
– Lovely Setia
Dec 6 '18 at 14:24
|
show 4 more comments
I am not sure I understand your question but you can add a new extension attributes that check stock status in rest/V1/carts/mine/items
and display the appropriate message.
Create your extension attribute in Vendor/ModuleName/etc/webapi_rest/extension_attributes.xml
<extension_attributes for="MagentoQuoteApiDataCartItemInterface">
<attribute code="stock" type="string" />
</extension_attributes>
Then Create your plugin to overwrite MagentoQuoteModelQuoteItemRepository::getList
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoQuoteModelQuoteItemRepository">
<plugin name="stock" type="VendorModuleNamePluginStock" disabled="false" sortOrder="70"/>
</type>
</config>
Then Create Stock.php in VendorModuleNamePluginStock.php
In Stock.php, we overwrite GetList with aroundplugin. We also get StockRegistryInterface to check If item is in stock by sku. Then we pass the message to our extension interface factory.
<?php
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace VendorModuleNamePlugin;
use MagentoQuoteModelQuoteItemRepository as ItemRepository;
class Stock
{
protected $quoteRepository;
protected $cartItemExtensionFactory;
protected $stockRegistry;
public function __construct(
MagentoQuoteApiCartRepositoryInterface $quoteRepository,
MagentoQuoteApiDataCartItemExtensionFactory $cartItemExtensionFactory,
MagentoCatalogInventoryApiStockRegistryInterface $stockRegistry
) {
$this->quoteRepository = $quoteRepository;
$this->stockRegistry = $stockRegistry;
$this->cartItemExtensionFactory = $cartItemExtensionFactory;
}
public function aroundGetList(ItemRepository $subject, Closure $proceed, $cartId)
{
$cartItems = $proceed($cartId);
/** @var MagentoQuoteModelQuote $quote */
$quote = $this->quoteRepository->getActive($cartId);
/** @var MagentoQuoteApiDataCartItemExtensionInterface $extensionAttributes */
$i = 0;
foreach ($quote->getAllVisibleItems() as $item) {
$extensionAttributes = $cartItems[$i]->getExtensionAttributes();
if ($extensionAttributes === null) {
$extensionAttributes = $this->cartItemExtensionFactory->create();
}
$sku = $item->getSku();
$stock = $this->stockRegistry->getStockItemBySku($sku)->getIsInStock();
if ($stock) {
$message = "Item In Stock";
} else {
$message = "Item Out Of Stock";
}
$extensionAttributes->setStock($message);
$cartItems[$i]->setExtensionAttributes($extensionAttributes);
$i++;
}
// $cartItems->setExtensionAttributes($extensionAttributes);
return $cartItems;
}
}
Thanks
I am not sure I understand your question but you can add a new extension attributes that check stock status in rest/V1/carts/mine/items
and display the appropriate message.
Create your extension attribute in Vendor/ModuleName/etc/webapi_rest/extension_attributes.xml
<extension_attributes for="MagentoQuoteApiDataCartItemInterface">
<attribute code="stock" type="string" />
</extension_attributes>
Then Create your plugin to overwrite MagentoQuoteModelQuoteItemRepository::getList
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoQuoteModelQuoteItemRepository">
<plugin name="stock" type="VendorModuleNamePluginStock" disabled="false" sortOrder="70"/>
</type>
</config>
Then Create Stock.php in VendorModuleNamePluginStock.php
In Stock.php, we overwrite GetList with aroundplugin. We also get StockRegistryInterface to check If item is in stock by sku. Then we pass the message to our extension interface factory.
<?php
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace VendorModuleNamePlugin;
use MagentoQuoteModelQuoteItemRepository as ItemRepository;
class Stock
{
protected $quoteRepository;
protected $cartItemExtensionFactory;
protected $stockRegistry;
public function __construct(
MagentoQuoteApiCartRepositoryInterface $quoteRepository,
MagentoQuoteApiDataCartItemExtensionFactory $cartItemExtensionFactory,
MagentoCatalogInventoryApiStockRegistryInterface $stockRegistry
) {
$this->quoteRepository = $quoteRepository;
$this->stockRegistry = $stockRegistry;
$this->cartItemExtensionFactory = $cartItemExtensionFactory;
}
public function aroundGetList(ItemRepository $subject, Closure $proceed, $cartId)
{
$cartItems = $proceed($cartId);
/** @var MagentoQuoteModelQuote $quote */
$quote = $this->quoteRepository->getActive($cartId);
/** @var MagentoQuoteApiDataCartItemExtensionInterface $extensionAttributes */
$i = 0;
foreach ($quote->getAllVisibleItems() as $item) {
$extensionAttributes = $cartItems[$i]->getExtensionAttributes();
if ($extensionAttributes === null) {
$extensionAttributes = $this->cartItemExtensionFactory->create();
}
$sku = $item->getSku();
$stock = $this->stockRegistry->getStockItemBySku($sku)->getIsInStock();
if ($stock) {
$message = "Item In Stock";
} else {
$message = "Item Out Of Stock";
}
$extensionAttributes->setStock($message);
$cartItems[$i]->setExtensionAttributes($extensionAttributes);
$i++;
}
// $cartItems->setExtensionAttributes($extensionAttributes);
return $cartItems;
}
}
Thanks
answered Jun 27 '18 at 12:49
Soladogun Ilyas AdemuyiwaSoladogun Ilyas Ademuyiwa
165
165
i think we can use a boolean flag <attribute code="stock" type="boolean" /> if ($stock) { $message = true; } else { $message = false; }
– sivakumar
Jun 27 '18 at 13:30
Thanks @sivakumar. Boolean is obviously better. But this still return a string of "0" and "1". Any reason for this??
– Soladogun Ilyas Ademuyiwa
Jun 28 '18 at 5:51
This code give error :Fatal error</b>: Uncaught Error: Call to undefined method MagentoQuoteApiDataCartItemExtension::setStock() in /Vendor/CheckStock/Plugin/Stock.php:46 @SoladogunIlyasAdemuyiwa
– Lovely Setia
Dec 5 '18 at 9:50
@LovelySetia Make sure you recompile. It should generate that attribute setStock in the generated folder since attribute code is stock
– Soladogun Ilyas Ademuyiwa
Dec 6 '18 at 11:01
I will deleted var/generation/*,var/page_cache/*,var/cache/*.After that run Setup:upgrade,setup:di:compile,setup:static-content:deploy commands.It still showing error @SoladogunIlyasAdemuyiwa
– Lovely Setia
Dec 6 '18 at 14:24
|
show 4 more comments
i think we can use a boolean flag <attribute code="stock" type="boolean" /> if ($stock) { $message = true; } else { $message = false; }
– sivakumar
Jun 27 '18 at 13:30
Thanks @sivakumar. Boolean is obviously better. But this still return a string of "0" and "1". Any reason for this??
– Soladogun Ilyas Ademuyiwa
Jun 28 '18 at 5:51
This code give error :Fatal error</b>: Uncaught Error: Call to undefined method MagentoQuoteApiDataCartItemExtension::setStock() in /Vendor/CheckStock/Plugin/Stock.php:46 @SoladogunIlyasAdemuyiwa
– Lovely Setia
Dec 5 '18 at 9:50
@LovelySetia Make sure you recompile. It should generate that attribute setStock in the generated folder since attribute code is stock
– Soladogun Ilyas Ademuyiwa
Dec 6 '18 at 11:01
I will deleted var/generation/*,var/page_cache/*,var/cache/*.After that run Setup:upgrade,setup:di:compile,setup:static-content:deploy commands.It still showing error @SoladogunIlyasAdemuyiwa
– Lovely Setia
Dec 6 '18 at 14:24
i think we can use a boolean flag <attribute code="stock" type="boolean" /> if ($stock) { $message = true; } else { $message = false; }
– sivakumar
Jun 27 '18 at 13:30
i think we can use a boolean flag <attribute code="stock" type="boolean" /> if ($stock) { $message = true; } else { $message = false; }
– sivakumar
Jun 27 '18 at 13:30
Thanks @sivakumar. Boolean is obviously better. But this still return a string of "0" and "1". Any reason for this??
– Soladogun Ilyas Ademuyiwa
Jun 28 '18 at 5:51
Thanks @sivakumar. Boolean is obviously better. But this still return a string of "0" and "1". Any reason for this??
– Soladogun Ilyas Ademuyiwa
Jun 28 '18 at 5:51
This code give error :Fatal error</b>: Uncaught Error: Call to undefined method MagentoQuoteApiDataCartItemExtension::setStock() in /Vendor/CheckStock/Plugin/Stock.php:46 @SoladogunIlyasAdemuyiwa
– Lovely Setia
Dec 5 '18 at 9:50
This code give error :Fatal error</b>: Uncaught Error: Call to undefined method MagentoQuoteApiDataCartItemExtension::setStock() in /Vendor/CheckStock/Plugin/Stock.php:46 @SoladogunIlyasAdemuyiwa
– Lovely Setia
Dec 5 '18 at 9:50
@LovelySetia Make sure you recompile. It should generate that attribute setStock in the generated folder since attribute code is stock
– Soladogun Ilyas Ademuyiwa
Dec 6 '18 at 11:01
@LovelySetia Make sure you recompile. It should generate that attribute setStock in the generated folder since attribute code is stock
– Soladogun Ilyas Ademuyiwa
Dec 6 '18 at 11:01
I will deleted var/generation/*,var/page_cache/*,var/cache/*.After that run Setup:upgrade,setup:di:compile,setup:static-content:deploy commands.It still showing error @SoladogunIlyasAdemuyiwa
– Lovely Setia
Dec 6 '18 at 14:24
I will deleted var/generation/*,var/page_cache/*,var/cache/*.After that run Setup:upgrade,setup:di:compile,setup:static-content:deploy commands.It still showing error @SoladogunIlyasAdemuyiwa
– Lovely Setia
Dec 6 '18 at 14:24
|
show 4 more comments
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%2f211823%2fcheck-products-in-cart-if-they-are-out-of-stock-before-place-order-rest-api-ma%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