Woocommerce shortcode clashing with Pro

Hi there,

When I put the [woocommerce_checkout] shortcode on a Pro page, it returns an error 500, but when it’s on a Gutenburg page, I have no issue.
Have spoken to my hosting provider and they said it’s an issue with the theme and Woo getting stuck in a loop and then timing out.

Normal page: http://travelteacher-co-uk.stackstaging.com/apply/
Pro page: http://travelteacher-co-uk.stackstaging.com/checkout/

Any help would be great as it’s holding up the site going live!

Thanks

Hello @RubberDuckers,

Thanks for writing in!

The [woocommerce_checkout] shortcode will only work on the page that you have assigned as your check out page. You will need to assign the WooCommerce pages properly. This can be done by:

  • Go to the “System Status” tab on Woocommerce
  • Click on the “Tools” tab at the top of the page
  • On that page, the sixth option down is called “Install pages”.
  • Clicking that will “install all the missing WooCommerce pages. Pages already defined and set up will not be replaced.”

Hope this helps.

Hi there,
Thanks for the response.
That doesn’t seem to have worked.
The shortcode was previously working on a no assigned page and still works on the non assigned page:
http://travelteacher-co-uk.stackstaging.com/apply/

But is still giving an Error 500 on the actual checkout page (which is now assigned as you suggested, too) http://travelteacher-co-uk.stackstaging.com/checkout/
Also to note, as soon as the shortcode is removed, the page works fine.

Any ideas?

Hi There,

Did you edit the WooCommerce Checkout page with Cornerstone? If yes, it would be conflicted between the [woocommerce_checkout] shortcode and content builder.

Because those are special pages controlled by WooCommerce template files, so please create a new checkout page and just paste the [woocommerce_checkout] shortcode to the page content.

Regards!

Hi,

That’s what I had initially - it works with Gutenburg on the none specified checkout page:
http://travelteacher-co-uk.stackstaging.com/apply

But even now I’ve just done a new page, using Pro and put the checkout shortcode in:
http://travelteacher-co-uk.stackstaging.com/test
And still get the Error 500.

All other account/basket pages work fine in Pro, just not the checkout, but obviously it’s quite important!

Hey @RubberDuckers,

The checkout shortcode works in my test site both in the builder and in the frontend.

This means that it’s highly likely that something in your WordPress setup is causing the issue. It could be a custom code in your child theme if you have made customization. It could also be a third party plugin conflict.

Would you mind switching to the parent theme then testing again if the issue persists? If the issue persists, please try testing for a plugin conflict. You can do this by deactivating all third party plugins, and seeing if the problem remains. If it’s fixed, you’ll know a plugin caused the problem, and you can narrow down which one by reactivating them one at a time.

Please also enable debugging and error logging in your site. You can follow the instruction at https://codex.wordpress.org/Debugging_in_WordPress. Specifically look at the example configuration under Example wp-config.php for Debugging.

You need to look at the error logs after that maybe we could get information what specifically is causing the issue.

Thanks.

Hi,

Thanks for that.
I’d tried disabling all plugins (all but Woocommerce) before but just tried now and also on the parent theme now and still no luck.

It has been visible in the builder for me, like yours, just not live.

I’m going to try and delete the theme and reinstall to see if that helps at all.

Then will try debugging.

Will update when done.

Thanks

Let us know how it goes!

OK so none of that worked…
New Pro and WC installs, disabled all plugins etc.

I put debugging and not getting any errors related to it…

If you click “Apply now” here - you will see the error:
http://travelteacher-co-uk.stackstaging.com/destinations/the-cook-islands/

The server errors are showing:

travelteacher-co-uk.stackstaging.com [Sun Dec 02 17:16:50 2018] [error] [client 82.30.197.228:0] End of script output before headers: index.php

Which I guess it it timing out trying to load the checkout - but as I said, loads on builder and also on other non-Pro pages, so no idea why it’s not loading in live?

Hello @RubberDuckers,

When I clicked Apply Now button, I will be redirected to the Apply and Pay page.

It could be that the error only occurs if you are logged in. Would you mind providing us access to your site?

Thanks.

Hi - yeah that’s the Gutenburg page (i switched it over so I can continue to set up the site.

http://travelteacher-co-uk.stackstaging.com/checkout/ - is the Pro page with the shortcode

Hello @RubberDuckers,

Thanks for updating in!

When I check the checkout url, I am seeing this:

And when I go back to the basket, add a product and then hit the “Proceed to checkout” button, I will be redirected to the Apply and Pay page. Please understand that you can only have one checkout page. In your case, it seems that the Apply and Pay page is the one being set as your check out page. Any other page that displays the [woocommerce_checkout] shortcode will not work because it is not the official checkout page.

Hope this explains it briefly.

Hi there, thanks for that info.

I originally didn’t have the Gutenberg checkout page, have just added that to test if the cart works at all.

Have removed and reverted to the Pro one but still no luck.

Shall I set you up as a user to have a look?

Thanks

Hello @RubberDuckers,

So what the is the page that is assigned as your checkout page in WooCommerce? You can change it in WooCommerce > Settings > Advanced > Page Set up.

And yes, please provide us access to your site so we can check your settings.

Thanks.

Have done that for the checkout page too.

Thanks

Hello @RubberDuckers,

It seems that there is a fatal error in the background process. Could you please enable the debug mode? You can do this by opening wp-config.php and adding


define('WP_DEBUG', false);

/* That's all, stop editing! Happy blogging. */

When we revisit the page, we should have some error output describing the issue in more detail.

Hi - sure, i’ve changed this to false now.

Thanks

Hello @RubberDuckers,

Still nothing displays in the checkout page with the error 500. Would you mind providing us the FTP login credentials instead so we can take a closer look and fix the issue?

To do this, you can make a post with the following info:

  • FTP Hostname
  • FTP Username
  • FTP Password

Thank you.

Hi there, of course.