2

Is there a way to make the purchase order number in the checkout page optional? without filling purchase order number text field, I want to place an order.

enter image description here

0

For this you need to remove the data-validate="{required:true}" from the input field. File path magento/module-offline-payments/view/frontend/web/template/payment/purchaseorder-form.html and also remove required class.

  • I tried this code but its not working. – kiran May 13 at 13:40
  • Hi @kiran, it's working fine on my side. – tanu Jun 13 at 11:02
0

You need to override the Model, in your di.xml

preference for="Magento\OfflinePayments\Model\Purchaseorder" type="Vendor\o\Model\Purchaseorder"
namespace Vendor\Module\Model;

class Purchaseorder extends \Magento\OfflinePayments\Model\Purchaseorder {

    public function validate()
    {
        //parent::validate();

        if (empty($this->getInfoInstance()->getPoNumber())) {
            //throw new LocalizedException(__('Purchase order number is a required field.'));
        }

        return $this;
    }

}

and in your ca

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.