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

73
Views
Edit already minified JavaScript snippet

I have to edit the minified snippet below to: IF a message (string) is handled by the snippet containing the word API then to change the entire message to Something went wrong. Try again later. Please let me know how I can do this. Thank you!

wc_myplugin.BaseGateway.prototype.submit_error = function(t) {
var e = this.get_error_message(t);
e.indexOf("</ul>") < 0 && (e = '<div class="' + function() {
    var t = "woocommerce-MyPlugin";
    return this.is_current_page("checkout") && (t += " woocommerce-MyPlugin-checkout"), t
}.bind(this)() + '"><ul class="woocommerce-error"><li>' + e + "</li></ul></div>");
t = o(document.body).triggerHandler("wc_myplugin_submit_error", [e, t, this]);
e = void 0 === t ? e : t, this.submit_message(e)
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I added var eMessage = e.contains('API') ? 'Something went wrong. Try again later' : e; on the third row. Basically, checks if the error message contains "API" (capital letters). If so, the error message is replaced, otherwise it remains the same.

wc_myplugin.BaseGateway.prototype.submit_error = function(t) {
var e = this.get_error_message(t);
var eMessage = e.contains('API') ? 'Something went wrong. Try again later' : e;
e.indexOf("</ul>") < 0 && (e = '<div class="' + function() {
    var t = "woocommerce-MyPlugin";
    return this.is_current_page("checkout") && (t += " woocommerce-MyPlugin-checkout"), t
}.bind(this)() + '"><ul class="woocommerce-error"><li>' + eMessage + "</li></ul></div>");
t = o(document.body).triggerHandler("wc_myplugin_submit_error", [e, t, this]);
e = void 0 === t ? e : t, this.submit_message(e)
about 4 years ago · Juan Pablo Isaza Report
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!