Ask your WordPress questions! Pay money and get answers fast! (more info)

Woocommerce, Payment gateway function not running on checkout

  • SOLVED

Hi All

I hope everyone is well,

I have an issue i need some help with,

Recently a client asked me to convert really old website to wordpress, to make it responsive and have a basic woocommerce framework to sell some goods online

I completed this at the beginning of the year, we've been using a paygate company called PayGate to do card payments and everything has been running well.

last month i decided to do a framework overhaul, I basically rebuilt the website upgrading wordpress and woocommerce to the latest versions but generally keeping the template and page content the same. The previous paygate gateway plugin I was using was a dev version, they have now released a formal version whichn i've now installed - Ive tested it on a brand new installation of wordpress and i know it works perfectly.

This is my issue

i've upgraded all woocommerce template files, some basic theme changes and I've installed the new paygate payment gateway plugin. When i click checkout with paygate with MY theme activated, the plugin does NOT redirect to the paygate payment portal as its supposed to, it just literally goes straight to the payment confirmation page

when i activate the twenty fifteen theme it DOES redirect to the paygate payment page

I have installed a fresh version of word press and installed just my theme, i've installed no other plugins beside woocommerce and the payment gateway plugin, and it still doesn't redirect it just goes straight to the payment confirmation page

when i check the console I get the following error with my theme, notn with twenty fifteen

Uncaught TypeError: $.blockUI is not a function

That code is within the Paygate plugin,

this is the code that is not running apparently


wc_enqueue_js('
$.blockUI({
message: "<img src=\"' . $woocommerce->plugin_url() . '/assets/images/ajax-loader.gif\" alt=\"Redirecting...\" /><br>' . esc_js(__('Thank you for your order. We are now redirecting you to PayGate to make payment.', 'paygate')) . '",
baseZ: 99999,
overlayCSS:
{
background: "#fff",
opacity: 0.6
},
css: {
padding: "20px",
zindex: "9999999",
textAlign: "center",
color: "#555",
border: "3px solid #aaa",
backgroundColor:"#fff",
cursor: "wait",
lineHeight: "24px",
}
});
jQuery("#submit_paygate_payment_form").click();
');



I disabled all other scripts except jquery and it still doesn't run,


the temporary link to see this is at
www.topofthemorning.co.za/test/1/

go to www.topofthemorning.co.za/test/1/shop
to test the check out

i'm happy to give access to the files and backend if need be

I'd really appreciate your assistance to figure this out, i'm not very clued up with jquery at all

Thanks alot in advance!

Best Regards
Michael
[email protected]




Answers (3)

2015-11-02

Romel Apuya answers:

change $.blockUI to jQuery.blockUI


Mike Peters comments:

Thanks for your reply Romel,

i tried that and now it just says

jQuery.blockUI is not a function

any other ideas?

2015-11-02

Shoeb mirza answers:

I changed the code to the following (check below) and pushed it below the another code which was there under the file. Probably that was the code which was causing the issue.. <script>
jQuery(document).ready(function( $ ) {
$.blockUI({
message: "<img src=\"' . $woocommerce->plugin_url() . '/assets/images/ajax-loader.gif\" alt=\"Redirecting...\" /><br>' . esc_js(__('Thank you for your order. We are now redirecting you to PayGate to make payment.', 'paygate')) . '",
baseZ: 99999,
overlayCSS:
{
background: "#fff",
opacity: 0.6
},
css: {
padding: "20px",
zindex: "9999999",
textAlign: "center",
color: "#555",
border: "3px solid #aaa",
backgroundColor:"#fff",
cursor: "wait",
lineHeight: "24px",
}
});

$("#submit_paygate_payment_form").click();
});
</script>


Shoeb mirza comments:

Well I've already completed the work with my code above working fantastic..


Mike Peters comments:

Thank you Shoeb this seems to have solved it!

I've put it up on the live server and its working.. thanks so much!

2015-11-02

Rempty answers:

Test with other theme,
Maybe your theme is not compatible with woocommerce.
You have wp_head() on your header.php and wp_footer() on your footer.php, if not add it, maybe all scripts are not loading succesfully.