Woocommerce shortcode clashing with Pro

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.

Hi @RubberDuckers,

Looks like a conflict but it’s normal when calling do_shortcode() within existing filters. It’s the same issue if you create a hook for the_content and call do_shortcode within it, it will cause a loop which will cause an internal error. And it depends on the shortcode that is being executed, and it happens that [woocommerce_checkout] triggers it.

While Gutenberg is a different builder, it doesn’t use preview that requires shortcode execution. If you’ll check the code generated by it, they aren’t a shortcode

<!-- wp:image -->
<figure class="wp-block-image"><img alt=""/></figure>
<!-- /wp:image -->

<!-- wp:image -->
<figure class="wp-block-image"><img alt=""/></figure>
<!-- /wp:image -->

And there is no conflict at all with other shortcodes.

Plus, Woocommerce added [woocommerce_checkout] to a dedicated/reserved without any other content. It’s added alone so I recommend leaving it as it is for now just like how Woocommerce added it. That’s why checkout customization for Woocommerce has a different way, some uses plugins, some with hooks and custom codes. Please check this https://hollerwp.com/customize-woocommerce-checkout-page/

If you’re just wrapping it with a layout, then I recommend adding them as raw HTML.

Thanks!

Thanks for all that info.

What you say here, do you mean making a HTML template for the page (not Pro) or putting the Woocommerce hook into a custom template?
I obviously want to use Pro for it as it’s used throughout the site, so what would you suggest to show the checkout on that page?

Thanks

Hi @RubberDuckers,

I mean just wrapping the Woocommerce shortcode with just HTML in the editor, example,

<p>Some text here is preferred</p>
<div class="a_wrapper">
[woocommerce_checkout] 
</div> 

Or yes, use Gutenberg since it only generates HTML too.

May I know what you wish to do in the checkout page that you like from other pages created in Pro? It’s Woocommerce page so the elements and another layout should be generated by Woocommerce itself.

Thanks!

Hi,

Thanks - I noticed you’d put it in a

but I’m still getting an error 500 on it.

It’s not really wanting to do anything it’s just Pro doesn’t do templates for blogs and products and I want the site to look consistent, so with shortcodes for some Woocommerce elements, having them on Pro pages at least keeps some consistency.
For blogs I’ve had to use Gutenberg unfortunately but ideally want to keep it all in Pro!

Cheers

Hi @RubberDuckers,

You mean you added this and still getting the 500 error?

<p>Some text here is preferred</p>
<div class="a_wrapper">
[woocommerce_checkout] 
</div>

I still see it added within the builder, hence yes, still the same result.

As for consistency, are you just referring to the first section with the background? If that’s the case, you should add it within the header of your page so it will be the same across the site. That’s the only thing I can see on your page that requires to be created in the builder.

Thanks!

Hi there - I usually avoid the header builder for cover sections like that, usually just doesn’t work as nicely as the page builder.
So I put the shortcode in the standard WP page bit, then put the template to include the header but still timing out…

Any ideas?

Hey @RubberDuckers,

If you’re not logged in, your checkout page (http://travelteacher-co-uk.stackstaging.com/checkout/) redirects to http://travelteacher-co-uk.stackstaging.com/basket/. This might have something to do with this issue.

Would you mind setting up a fresh WordPress install in your site and only install Pro and WooCommerce. The result of this will tell us that you have configured something in your current WordPress install that causes this issue.

If you can, it would also be best to test in other server environments to test if something in your server is causing this. You can setup a test site locally in your computer or you can find host that offers free test site like pantheon.io.

Regretfully, I am not capable of tracing where the issue is coming from so I suggest that we test reversing the setup. And, this also is unlikely a bug because the setup works in my test site so testing in different setups is necessary for us to submit this to our issue tracker.

Thanks.

Hi,
Thanks will do that.
I think that it’s redirecting to the basket if you haven’t added anything yet?
But I will put the shortcode on another site on the server and see what happens!

Thanks

So that all appears to work

http://travelteacher-co-uk.stackstaging.com/test/product/test/

I’ve installed Pro, Woo and of course WP. I’ve also included the Direct to Checkout plugin I was using so you should skip the basket.

I’ve assigned the Checkout page to the home page (sample one in this instance) and put the shortcode on there.

All seems to work.

I have tried disabling all plugins on the actual site, have also reinstalled Pro and Woo - so I guess the only thing that is left is the WP install? Unless you can think of anything else?

Yes, I believe so. Please try re-installing WordPress by going to Dashboard > Updates and click the Re-install Now button.

Regretfully, I have no other ideas if the still won’t work in the live site.

Thanks.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.