PHP 8.0 General Question

Just updated a WC site running Pro 5.1.5 to PHP 8.0 (Kinsta forced it on us) and there were some real issues. Assuming you guys are testing RC1+ on PHP8? Specifically for WooCommerce and even more specifically with ATC Form elements?

What I noticed (among many other things) was that the cornerstone Add To Cart Form does not display on the front end at all (but shows in the preview). Many layout rules were broken. Shop layout was overridden. Conditional logic wasn’t being respected. Etc.

Totally understand that this could be due to plugins but started deactivating one by one to try and track down the culprit and got about halfway through when Kinsta conceded and rolled us back to 7.4. All good now (for now…)

So, in a nutshell, are we testing V6 on PHP8+? Because I sure am not.

I’m running Ubuntu 22.04 + PHP8.1.2 as my main environment. We’ve fixed all fatal errors at this point that have come up (some of my first fixes here actually). I will have to check ATC Form elements. Some of the extensions like email forms and under construction had to be updated to use 8 and we probably won’t update those until we go live with 6.0. If you’re getting 8 forced on you I’d suggest just jumping to 8.1 when the time comes I think it runs great and it’ll give you more time on the next upgrade. We all will get a ton of Deprecation notices until Wordpress fully supports 8, but it’s nothing to worry about. Mostly based around php 8 being more strict on types.

It does not look add to cart form is working, but it will be. Thanks for the feedback.

Nevermind on that working fine. Just didn’t have a product setup for my preview.

Following up on this. Same client accidentally upgraded the site again to PHP 8.0 and all went south. Deactivated the entire plugin directory and critical error persisted. Reactivated all plugins and deactivated Pro Theme and all is back up and running…

Update. Narrowed it down to the child theme. Looks like it was a custom snippet on my end. :man_facepalming: Sorry…

This was the culprit :point_down:

function remove_image_zoom_support() {
    remove_theme_support( 'wc-product-gallery-zoom' );
}
add_action( 'wp', 'remove_image_zoom_support', 100 );

is_admin() && add_action( 'pre_get_posts', 'extranet_orderby' );

Separately, this site was also upgraded to 6.0.2 and it looks like in 6.0.2 you can no longer have a manual looper / consumer on an archive page?

For example, you used to be able to build an archive page using the default looper provider on an archive. But then, elsewhere on the page, you could add in a separate looper provider / consumer combo to do things like loop in featured products, etc.

This technically functions as you’ll see from the debug consumer data. But the data is unable to be tapped into via dynamic content (as you’ll notice, the word “Shop” is repeated over and over – this used to be the product title). Featured images are missing. Etc.

Hey Happy new year.

Could you send me a screenshot of how you are setting up the featured image looper? Like the looper provider setup inside your product consumer. Just want to make sure we are on the same page.

Somebody else contacted me about this. When you do{{dc:woocommerce:product_title}} does that get you the desired title? I think the issue might be {{dc:post}} is not being set to the current looper product item. Let me know if you are sharing that issue.

That was 100% it. Think that must be an issue though, no? Because this has been working on this site for the last year in all the 5.X.X versions.

Had to change:

{{dc:post:featured_image_id}} --> {{dc:woocommerce:product_image_id}}
{{dc:post:title}} --> {{dc:woocommerce:product_title}}

@charlie – separately, I’ve had to help people out with this one in the X/Pro FB group and have noticed it regularly myself. Just so happens it occurred when I went to take the screenshots for you so I though I’d share.

  1. When loading up various templates in the layout builder (archive or single) the template structure shows up in the outline but the preview does not appear to work. Have seen many people (including myself) thinking that their templates are broken after the update to V6.

  2. I began noticing that - without fail - the preview is always blank which makes things look broken.

  1. Setting the preview (in this case “Shop”) fixes the issue.

  2. Once reconnected, all is back to normal and I can actually preview my layout. But I literally just did this yesterday too. So every time I open it, it appears disconnected.

Even worse, sometimes it’ll show up with the stack’s default archive or post layout. Making you think something is working but overriding your layout. Isn’t until you do the steps above that you realize you were just looking at the default.

In 5.1.5 and prior – I almost never had to toggle this unless it was the first time building the layout.


Case in point :point_down:

1 Like

Yeah the looper not changing the Post in a WC layout is an issue. We’ll get that handled.

Yeah the archive creating could be handled better. Having defaults can definitely fix this. Like you said with the preview. Improving usability and speed in creation is definitely on my list this year. Thanks a bunch for all you do!

1 Like

@charlie - Thanks for all you guys do as well! Glad to hear the WC layout issue will be taken care of. Regarding the layout editing – honestly, I’m not all that certain it’s a workflow issue. Seems like a bug. If I’ve specified the layout assignments under conditions, shouldn’t it default to that in the preview?

One more for you that I noticed this morning. Sorry to hijack this PHP8.0 thread for items not on topic (but I will :p)

Acf fields no longer show up in 6.0.2. I can manually enter them and they work but here’s a comparison of the same site, same layout, same raw content on 5.1.5 and 6.0.2.

I’ve also noticed this on completely new 6.0.X builds as well that weren’t upgrades from 5.1.5.

2 Likes

To add to this, while I was screenshotting this for the other thread you and I have going, I was able to reproduce the default layout issue which definitely piggy-backs on this issue. I’ve set this who knows how many times but when I opened it up in the layout builder this is what it looked like:

Then I checked the preview pane and saw that it wasn’t set (again):

So I set it (again) and we’re back to how it should look:

Just super odd and while I can deal with the workarounds. I feel that users are going to simply think things are broken time and time again.

1 Like

I’ll definitely get the acf field list showing up again.

Totally agree that it’ll look broken in that fashion. I believe certain layouts already save that preview data so I’ll see about getting that feature everywhere.

1 Like

yes please to fixing the acf fields

3 Likes

+1 to this!

1 Like

Will be fixed in the next release! The issue affected some other dynamic fields and they’ll hopefully all be fixed.
Also after you add a field group in ACF you have to make sure you save in the WpEditor at least once or there won’t be any fields associated to it.

@charlie – noticed the ACF dropdown fix is in place and appreciate it! Came to my attention (via somebody else) that the dropdowns are still broken when trying to access acf fields in looper setups.

Here is a button on a homepage (no ACF fields on homepage)
Button is housed inside of a div setup as a Looper Provider pulling through a CPT with ACF fields
Button is a Consumer on the Provider

Here it is in 5.1.5 (notice that once there is a looper, it finds the looped CPT ACF fields)
Screen Shot 2023-02-16 at 7.16.41 AM

Here it is in 6.1.2 (notice that once there is a looper, it is not able to find looped CPT ACF fields)
Screen Shot 2023-02-16 at 7.17.42 AM

Okay I’ll make sure that’s working inside loopers too. Thanks for bringing this to my attention!