Linked Questions

4 votes
2 answers

How to get all children product from parent configurable product in magento2

I need to display some custom attribute from children product in checkout, I study for long time to come out a stupid solution Override Magento\Swatches\Block\Product\Renderer\Configurable Inject ...
user43151's user avatar
3 votes
2 answers

Get stock for a product in Magento 2

I want to display the current stock of a specific product in a theme. How can I do that? getStock() does not seem to work.
Max's user avatar
  • 1,844
3 votes
2 answers

How to access to configurable product stock qty via js?

Someone knows how to get qty for each simple product of configurable product via javascript in product page? It seems that spConfig retrieved with #product_addtocart_form": { "configurable": { ...
LucScu's user avatar
  • 2,332
1 vote
2 answers

Magento 2 get and set Qty of product with observer

I tried my code below to get Qty from observer when a page loaded : Observer : public function execute(\Magento\Framework\Event\Observer $observer) { $collections = $observer->getEvent()->...
Edwin Widhiyanto's user avatar
0 votes
3 answers

Get all visible products whose Quantity greater than 0 in Magento2

I have written a product collection to get all products whose quantity is greater than 0. Here is my code for the collection <?php $websiteId = $this->storeManager->getStore()->...
Manjunath's user avatar
  • 177
1 vote
2 answers

Magento 2 Unable To Get Simple Product Quantity

I am unable to get simple product's quantity Can anyone help out please. I have tried: $product = $block->getAllowProducts(); foreach ($product as $child) { print_r($child->getQty()); ...
Juliano Vargas's user avatar
0 votes
1 answer

301 Redirect the Out of Stock Product Pages

Want to redirect for the products who are out of stock to custom url Had tried below url but it did not helped
insoftservice's user avatar
1 vote
2 answers

M2: How to get total stock qty

I will try get total stock product qty. I use this below code: <?php echo "Total qty: "; ?> <?php $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $...
Sylvester's user avatar
  • 2,234
1 vote
2 answers

display stock information to logged customer only in Magento 2?

I want to display stock only to logged customers in product page. can you guide me how can I do and in which file?
gill's user avatar
  • 339
0 votes
0 answers

Magento 2 Available Qty Check Before Taking Customers to Payment Gateway

When customer tried to place an order , In my website i have only one Qty for each SKU. When two different customers tried to place an order on same time for same SKU one customer got an order number ...
Dinesh's user avatar
  • 552
0 votes
1 answer

hello guys please help me out how to get product quantity option on product listing page

this is my list.phtml code and look instead I want to display like my code <div class="products wrapper <?= /* @noEscape */ $viewMode ?> products-<?= /* @noEscape */ $viewMode ?>...
shaziyali's user avatar