We can create a layout file on the frontend using the block or pages from magetno admin panel here the trick used to create that. all phtml using block code login to magento admin. Open any cms page and write block code in content section. Here we called an external phtml file to a page… Continue reading Call Phtml file on CMS Page – Magento2
Author: Bibin Johnson
Disable a shipping method based on a condition
Here we’re considering the ordertotal of the cart. di.xml file
API to update the inventory to Magento without manging stock
Here we’re having a REST API which is used to update the inventory from any external Source of integrationHere we have considered NetSuite API: https://example.com/rest/default/V1/inventory/stocks/{stockId} body { “stock”: { “stock_id”: 0, “name”: “string”, “extension_attributes”: {} } } Response Example
Add a row count to the order sales view items table – Magento 2.4
We want to add a row count in the order sales view items table. There are 2 ways to achieve this: Let’s start by creating a module Vendor_RowCounter, with the required files, and shared files for both solutions: Add registration.php: Add etc/module.xml: Create a block file, Block/Adminhtml/Items/Column/Row.php: Create a template file, view/adminhtml/templates/items/column/row.phtml: By adding a column via sales_order_view.xml Create view/adminhtml/layout/sales_order_view.xml: The drawback… Continue reading Add a row count to the order sales view items table – Magento 2.4
How to set a date field in a ui form to be mandatory?
normal Date field in the form need to modify with required fields with the new required field
State code to update the customer address from API
Here we are mentioning to set the state code from the country code and state id from the Netsuite API. We are getting the state and country through the response/params from the API
CSP whitelist in Magetno 2
Content Security Policies (CSP) are a powerful tool to mitigate against Cross Site Scripting (XSS) and related attacks, including card skimmers, session hijacking, clickjacking, and more. By default, Content Security Policiy is configured in report-only mode, which allows merchants and developers to configure policies to work according to their custom code. Your browser is not showing… Continue reading CSP whitelist in Magetno 2
Observer when updating products from Checkout
Using this observer we can monitor the update or trigger any conditions on updating the carthere we’re setting the backorders on update Considering all the stocks on the inventory and store
Observer to set backorder on adding products to the cart
Observser Code to Update the backorder to the custom field and checkout pageAlso setting the price of the products to Zero if the item is not committed
API to Update NetSuite Order Id to Magento
Here we’re calling an external API on the Magento to update a custom field on the sales order table to fetch the NetSuite Order ID to Magento 2. routes.xml