Home › Forums › Bug Reports › ACF block does not work with wc_get_template_part
Hello,
I created a block to display WooCommerce product list and I loaded the product template file with wc_get_template_part().
It was working fine, but after updating ACF Pro to version 5.11, the block stops showing the product list in editor (on front-end it works fine). In editor the block is empty.
When I downgrade ACF Pro to 5.10.2, it works fine again.
Can someone help me?
Hey @kezily
Could you drop us an email to [email protected] with a copy of your block registration and template code so we can try to reproduce this?
Thanks!
What if you try:
<?php include( locate_template( 'includes/loop.php', false, false ) ); ?>
Just change the directory from includes to what you need and loop.php to the name of your file.
Does that work for you?
How did this turn out? I wish it had been public so I could see, because I’ve experienced the same thing with wc_get_template_part()– it renders an empty block, but if you switch to Preview mode and back to Edit, the block renders fine. It works fine on the front end, of course. If I just individually call for the_title, the_content, the_post_thumbnail, for example, it works perfectly on the back end, but I obviously want all the woocommerce goodies like price etc.
It’s been this way for quite a while but it’s not a showstopper since you can toggle preview/edit.
Hello @girldetective
Unfortunately it was not resolved by ACF support. I still have the same problem.
Support reported that this issue is from WooCommerce and not ACF.
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.