Skip to content

Magetno 2 how to send the request of place order when user checked on the check box of terms and condtion

i have changed the checkout process into 4 steps

  1. Adress
  2. shipping
  3. payment methods and agreement
  4. summary and placeorder button

everything is working fine accept the terms and condtion. i have put the vaidation that user has to check the box for agreement other wise he wont be able to move to the last step i.e (summary and place order button). the validation is working fine, but when user check the agreement box then he able to move himself on the last step. and ther when he click on place order function i get the error of

The order wasn’t placed.First, agree to the terms and conditions, then try placing your order again.

do i need to send some ajax request for agreement or attach something with place order button so i dont get this error.

this is what my placeorder function looks like

placeorder: function(){
            $('.payment-method._active .primary button.checkout').trigger('click');
        },

if i try with the setting from admin panle to agreement automatic but it wont work on manually. how can i do it manually?

what i found till is this file is responsible for erro

vendor/magento/module-checkout/Model/PaymentInformationManagement.php

how i can override this file?