To check the product is saleable or not

In Magento, there is option to show the out of stock products. So that time we need to check whether the product is saleable or not for that, we need to check it for configurable and simple products if ($_product->getTypeId() != ‘configurable’) {$objectManager = \Magento\Framework\App\ObjectManager::getInstance();$StockState = $objectManager->get(‘\Magento\InventorySalesAdminUi\Model\GetSalableQuantityDataBySku’);$qty = $StockState->execute($_product->getSku());$isSaleable = $qty[0][‘qty’];} else {$isSaleable = $_product->isSaleable();}… Continue reading To check the product is saleable or not

Published
Categorized as Magento

How to expose a custom field from the sales_order table to the rest api?

Suppose you have a custom field delivery_type in the sales_order table.  You are accessing order using rest Api but this field is not present in the response. Requested API: http://localhost/default/rest/default/V1/orders/{order_id} You can get it working for individual orders. Though if you want to show this attribute in order collection as well you have to modify getList the method also. You have to create… Continue reading How to expose a custom field from the sales_order table to the rest api?

Published
Categorized as Magento

For the previously purchased customer needs to show the same price he is purchased on all the time on the website

If a customer purchased a product at the price 100 and then the price of that product has been changed to 200. But whenever the customer visits the website, for them it needs to display the price as same they purchased previous time. For this requirement, we need to set product prices based on the… Continue reading For the previously purchased customer needs to show the same price he is purchased on all the time on the website

Published
Categorized as Magento

Custom API integration in magento2

If we would need any API integrations on sometimes to connect with any external platform to send and receive data. Magento has its own integration API for its predefined events such as product, category, etc integrations.But need to do any external API calls for a particular reason or functionality, we can use PHP CURL method… Continue reading Custom API integration in magento2

Published
Categorized as Magento

Integrate an extra step in the checkout in Magento2

Sometimes we need to integrate or create a new step or tab in the checkout. We can able to achieve it through a custom Magento module. Create a layout file in the extension folderEx: vendor/Extension/view/frontend/layout/checkout_index_index On the layout file, sort order key is meant by the position of the tab in the checkout. Sort order… Continue reading Integrate an extra step in the checkout in Magento2

Published
Categorized as Magento

Common layout for dynamic url in magento2

If two custom url must show a common layout template and need to show the data on the template file based on the `id` passed on.ex:domain/shop/index/order/id/1/domain/shop/index/order/id/2/ Here shop is the route ID in the route file in the etc folder.index :- Folder inside the controller.order: The controller file. Create a layout file based on this.… Continue reading Common layout for dynamic url in magento2

Published
Categorized as Magento

How to use different layouts for different category levels.

Sometimes we need to use different layouts or structures based on category levels. For this, we can able to use different layouts based on different category levels. Solution: To create different layout structures for different categories develop layout files under the Magento_Catalog. One option would be adding a layout handle based on the category depth… Continue reading How to use different layouts for different category levels.

Published
Categorized as Magento

Product Schema Installation on Magento2

Magento basically having the product schema details we can add any extra content with our preference. To manage the product schema we can use a common file on the magento2. We can able to manage it on module Magento_catalog. The file location will be Magento_Catalog/templates/product/view/opengraph/general.phtml Thank you.