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.
How to Make Purchase Order Number Optional in Magento 2
That’s it.
Do consider sharing this post with Magento Community via social media.
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.
Thank you.

Steps to Make Purchase Order Number Optional in Magento 2

  1. Copy the below file

    To

    If the purchaseorder-form.html file already exists, then edit that file.

  2. Search the below code in the purchaseorder-form.html file.
  3. Replace the above code with
  4. Use the below code in your custom module’s plugin file di.xml at app/code/[Vendor]/[Module]/etc
  5. Create Purchaseorder.php file at app/code/[Vendor]/[Module]/Plugin/Model

How to Make Purchase Order Number Optional in Magento 2
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?
I would be happy to answer your question.
Something went wrong.
After applying the above code, one can place an order without entering a purchase order.
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.
If you have queries regarding this blog, feel free to ask in the Comments section below.

Get Weekly Updates

Never miss Magento tips, tricks, tutorials, and news.

Thank you for subscribing.
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.

/**/

/*.mfp-bg{background:#000000d4}
/*]]>*/

/*.mfp-bg.mfp-ready{opacity:.6}
/*]]>*/

(based on 8 Reviews)