How to Make Purchase Order Number Optional in Magento 2
Purchase Order (PO) is one of the payment methods in Magento 2 that allow commercial customers to pay for authorized purchases by referencing the PO number.
This payment method is usually applied for wholesale orders. In order to configure the purchase order, we have to set “Yes” in the “enabled” option of the ‘Purchase Order’ section from Stores > Settings > Configuration > Sales.
After applying the configuration for the purchase order, it displays at the checkout page while completing the payment method as shown in the below image.
In most cases, agencies or any other business place wholesale orders in the store. If demanded order is available, the store owner can ship that product to the customer, but what if ordered products are not available? In that scenario, the customer registers their name, required stocks, and pay the total amount or decided half amount.
The customer gets a purchase order number, but what if the customer does not have a purchase order number and still wants to purchase the product?
In the default behaviour of Magento 2, it will not allow placing an order without a purchase order as it is a required field. Use the below code and make purchase order number optional in Magento 2.
Steps to Make Purchase Order Number Optional in Magento 2
- Copy the below filevendor/magento/module-offline-payments/view/frontend/web/template/payment/purchaseorder-form.html
2.Search the below code in the purchaseorder-form.html file.
3.Replace the above code with
After applying the above code, one can place an order without entering a purchase order.