Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

117
Views
Woocommerce cart page custom js not working after applying coupon. I send cart data to external domain on proceed to checkout

I am sending the cart data of woocommerce to an externally hosted checkout page with the click of the 'proceed to checkout button. I just create inputs by looping the table and changing the cart form action URL to my external checkout page URL. My javascript function on button click stops after applying the coupon. If I reload the page, it starts working perfectly. Any suggestions on what could be blocking my js?


jQuery('a.checkout-button button alt wc-forward').click(function(e){
       
    e.preventDefault();
 
jQuery('.cart_item').last().after('<input type="hidden" name="totalprice[]" value="'+jQuery('.order-total td').text()+'">');
jQuery('table.shop_table > tbody  > tr').each(function(index, tr) { 
     if(jQuery(tr).hasClass('cart-discount'))
       
    
{jQuery('.cart_item td:last').after('<td class="coupon-val"><input type="hidden" name="coupon[]" value="'+jQuery(tr).find('th').text().replace(/Coupon:/g,"")+'" ></td>');
 jQuery('.cart_item td:last').after('<td class="coupon-discount-val"><input type="hidden" name="coupon-discount[]" value="'+jQuery(tr).find('.woocommerce-Price-amount').text()+'" ></td>');
}
  //jQuery(this).attr('href','http://localhost/test1/datapost.php');
});
    
//jQuery('form.woocommerce-cart-form').attr('action' , 'http://localhost/test1/datapost.php');
    
  jQuery('form.woocommerce-cart-form').attr('action' , 'http://localhost/test1/datapost.php');
  jQuery('form.woocommerce-cart-form').attr('id' , 'fsubmit');
  jQuery('form.woocommerce-cart-form').removeAttr('class');
  jQuery('body').find('#fsubmit').submit();
  })****
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!