WooCommerce Blocks not rendering on Single Posts
-
I’m able to choose a WooCommerce block and make updates in edit but when I go to preview the single post the blocks’s html is not being rendered
For context the WooCommerce blocks work on pages but not single postsWhat I’ve tried
- I don’t see any JS console errors
- I tried adding some woocommerce code in
functions.php
to load the necessary WC scripts on?single
?posts - I checked the error logs and nothing related to this issue
Here is a loom video of the issue:
-
Hi there!
I understand your concern. To help you further, could you please share the URL of the post where you’re experiencing this issue?
I tested displaying products on my post using both the shortcode and the default WooCommerce block, and the products appeared as expected on my end. You can see my example here: https://shahzeen-testing.mystagingwebsite.com/2024/10/10/hello-world/.
For us to investigate this further, can you please try to switch to the?default Storefront theme?and only WooCommerce plugin is enabled and see if this resolves the issue?If so, then this kind of problem is usually caused by your theme or a third-party plugin present on your site. We can run a conflict test to verify this. I’d recommend cloning your site to a staging environment and performing the tests described on this guide without modifying your live site or impacting customers. Many hosts provide staging facilities, so it’s worth checking in with them. It’s also possible to do it using the free WP Staging plugin.
If this was caused by a third-party plugin present on your site, it would be best to reach out to the developers for further assistance here.If this did not resolve the issue.
In the meantime, I’d like to understand your site properly. Please share with us the necessary information below for us to investigate the issue further:- System Status Report?which you can find via WooCommerce > Status > Get system report > Copy for support.
- Fatal error logs?(if any) under WooCommerce > Status > Logs.
Once we have more information, we’ll be able to assist you further.
I added the storefront theme with the woocommerce plugin only and I get a JSON error when trying to add a woocommerce block to a post
Here’s the system status report:
WordPress Environment<br><br>WordPress address (URL): https://sports-technology-labs.local<br>Site address (URL): https://sports-technology-labs.local<br>WC Version: 9.3.3<br>Legacy REST API Package Version: The Legacy REST API plugin is not installed on this site.<br>Action Scheduler Version: ? 3.8.1<br>Log Directory Writable: ?<br>WP Version: 6.6.2<br>WP Multisite: –<br>WP Memory Limit: 256 MB<br>WP Debug Mode: –<br>WP Cron: ?<br>Language: en_US<br>External object cache: – Server Environment<br><br>Server Info: nginx/1.26.1<br>PHP Version: 8.1.29<br>PHP Post Max Size: 1,000 MB<br>PHP Time Limit: 1200<br>PHP Max Input Vars: 4000<br>cURL Version: 7.77.0<br>(SecureTransport) LibreSSL/2.8.3<br><br>SUHOSIN Installed: –<br>MySQL Version: 8.0.16<br>Max Upload Size: 300 MB<br>Default Timezone is UTC: ?<br>fsockopen/cURL: ?<br>SoapClient: ?<br>DOMDocument: ?<br>GZip: ?<br>Multibyte String: ?<br>Remote Post: ?<br>Remote Get: ? Database<br><br>WC Database Version: 9.3.3<br>WC Database Prefix: wp_<br>Total Database Size: 39.41MB<br>Database Data Size: 27.86MB<br>Database Index Size: 11.55MB<br>wp_woocommerce_sessions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB<br>wp_woocommerce_order_items: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_woocommerce_order_itemmeta: Data: 0.08MB + Index: 0.06MB + Engine InnoDB<br>wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB<br>wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB<br>wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB<br>wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_actionscheduler_actions: Data: 3.52MB + Index: 3.14MB + Engine InnoDB<br>wp_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_actionscheduler_logs: Data: 1.52MB + Index: 1.94MB + Engine InnoDB<br>wp_affiliate_wp_affiliatemeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_affiliate_wp_affiliates: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_affiliate_wp_campaigns: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_affiliate_wp_connections: Data: 0.02MB + Index: 0.00MB + Engine InnoDB<br>wp_affiliate_wp_coupons: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_affiliate_wp_creativemeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_affiliate_wp_creatives: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_affiliate_wp_custom_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_affiliate_wp_customermeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_affiliate_wp_customers: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_affiliate_wp_direct_links: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_affiliate_wp_groups: Data: 0.02MB + Index: 0.00MB + Engine InnoDB<br>wp_affiliate_wp_lifetime_customers: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_affiliate_wp_notifications: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_affiliate_wp_payouts: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_affiliate_wp_referralmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_affiliate_wp_referrals: Data: 0.19MB + Index: 0.05MB + Engine InnoDB<br>wp_affiliate_wp_rest_consumers: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_affiliate_wp_sales: Data: 0.06MB + Index: 0.05MB + Engine InnoDB<br>wp_affiliate_wp_visits: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_automatewoo_abandoned_carts: Data: 0.02MB + Index: 0.08MB + Engine InnoDB<br>wp_automatewoo_customer_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_automatewoo_customers: Data: 0.02MB + Index: 0.09MB + Engine InnoDB<br>wp_automatewoo_guest_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_automatewoo_guests: Data: 0.02MB + Index: 0.06MB + Engine InnoDB<br>wp_automatewoo_log_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_automatewoo_logs: Data: 0.02MB + Index: 0.05MB + Engine InnoDB<br>wp_automatewoo_queue: Data: 0.02MB + Index: 0.05MB + Engine InnoDB<br>wp_automatewoo_queue_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_commentmeta: Data: 0.06MB + Index: 0.03MB + Engine InnoDB<br>wp_comments: Data: 0.09MB + Index: 0.09MB + Engine InnoDB<br>wp_gf_addon_feed: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_gf_draft_submissions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_gf_entry: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_gf_entry_meta: Data: 0.02MB + Index: 0.05MB + Engine InnoDB<br>wp_gf_entry_notes: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_gf_form: Data: 0.02MB + Index: 0.00MB + Engine InnoDB<br>wp_gf_form_meta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB<br>wp_gf_form_revisions: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_gf_form_view: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_gf_rest_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_options: Data: 3.52MB + Index: 0.08MB + Engine InnoDB<br>wp_postmeta: Data: 7.52MB + Index: 3.03MB + Engine InnoDB<br>wp_posts: Data: 9.13MB + Index: 0.22MB + Engine InnoDB<br>wp_taxjar_record_queue: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_term_relationships: Data: 0.05MB + Index: 0.02MB + Engine InnoDB<br>wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_termmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_usermeta: Data: 0.30MB + Index: 0.14MB + Engine InnoDB<br>wp_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB<br>wp_wc_admin_note_actions: Data: 0.05MB + Index: 0.02MB + Engine InnoDB<br>wp_wc_admin_notes: Data: 0.06MB + Index: 0.00MB + Engine InnoDB<br>wp_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB<br>wp_wc_customer_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_wc_order_addresses: Data: 0.02MB + Index: 0.06MB + Engine InnoDB<br>wp_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_wc_order_operational_data: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_wc_order_product_lookup: Data: 0.02MB + Index: 0.06MB + Engine InnoDB<br>wp_wc_order_stats: Data: 0.02MB + Index: 0.05MB + Engine InnoDB<br>wp_wc_order_tax_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB<br>wp_wc_orders: Data: 0.02MB + Index: 0.11MB + Engine InnoDB<br>wp_wc_orders_meta: Data: 0.19MB + Index: 0.39MB + Engine InnoDB<br>wp_wc_product_attributes_lookup: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_wc_product_download_directories: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_wc_product_meta_lookup: Data: 0.02MB + Index: 0.11MB + Engine InnoDB<br>wp_wc_rate_limits: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB<br>wp_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB<br>wp_wpfm_backup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB Post Type Counts<br><br>acf-field: 60<br>acf-field-group: 4<br>acf-ui-options-page: 1<br>attachment: 310<br>aw_workflow: 3<br>nav_menu_item: 21<br>oembed_cache: 80<br>page: 33<br>post: 71<br>product: 66<br>revision: 135<br>shop_order_placehold: 32<br>videos: 3<br>wp_block: 1<br>wp_font_face: 33<br>wp_font_family: 12<br>wp_navigation: 2 Security<br><br>Secure connection (HTTPS): ?<br>Your store is not using HTTPS. Learn more about HTTPS and SSL Certificates.<br>Hide errors from visitors: ? Active Plugins (16)<br><br>Advanced Custom Fields PRO: by WP Engine – 6.3.10<br>AffiliateWP - Lifetime Commissions: by Sandhills Development<br>LLC – 1.6.2<br><br>AffiliateWP: by AffiliateWP – 2.27.1<br>AffiliateWP - Affiliate Landing Pages: by AffiliateWP – 1.3.0<br>AffiliateWP - Direct Link Tracking: by AffiliateWP – 1.3.2<br>SnappyPay Credit Card: by SnappyPay – 5.5<br>DFin Sell Payment Gateway: by DFin Sell – 1.0.4<br>edebit-direct-draft-gateway: by eDebit Direct LLC – 2.0.0.2<br>Health Check & Troubleshooting: by The www.ads-software.com community – 1.7.1<br>Jetpack: by Automattic – 13.9.1<br>TaxJar - Sales Tax Automation for WooCommerce: by TaxJar – 4.2.3<br>WooCommerce eGiftCertificate: by YnloUltratech – 1.0.9<br>WooCommerce Shipping: by WooCommerce – 1.2.1<br>WooCommerce: by Automattic – 9.3.3<br>WordPress Importer: by wordpressdotorg – 0.8.3<br>WP File Manager: by mndpsingh287 – 8.0 Inactive Plugins (6)<br><br>AutomateWoo: by WooCommerce – 6.0.25 (update to version 6.1.0 is available)<br>Gravity Forms: by Gravity Forms – 2.8.18<br>Gravity Forms HubSpot Add-On: by Gravity Forms – 2.1.0<br>RocketFuel Payment Gateway: by Rocketfuel Team – 3.2.3.5<br>Upsell Order Bump Offer for WooCommerce: by WP Swings – 2.4.2<br>Upsell Order Bump Offer for WooCommerce Pro: by WP Swings – 2.3.6 Dropin Plugins ()<br><br>advanced-cache.php: advanced-cache.php Must Use Plugins (1)<br><br>Health Check Troubleshooting Mode: by – 1.9.2 Settings<br><br>Legacy API Enabled: –<br>Force SSL: ?<br>Currency: USD ($)<br>Currency Position: left<br>Thousand Separator: ,<br>Decimal Separator: .<br>Number of Decimals: 2<br>Taxonomies: Product Types: external (external)<br>grouped (grouped)<br>simple (simple)<br>variable (variable)<br><br>Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog)<br>exclude-from-search (exclude-from-search)<br>featured (featured)<br>outofstock (outofstock)<br>rated-1 (rated-1)<br>rated-2 (rated-2)<br>rated-3 (rated-3)<br>rated-4 (rated-4)<br>rated-5 (rated-5)<br><br>Connected to WooCommerce.com: –<br>Enforce Approved Product Download Directories: ?<br>HPOS feature enabled: ?<br>Order datastore: Automattic\WooCommerce\Internal\DataStores\Orders\OrdersTableDataStore<br>HPOS data sync enabled: – Logging<br><br>Enabled: ?<br>Handler: Automattic\WooCommerce\Internal\Admin\Logging\LogHandlerFileV2<br>Retention period: 30 days<br>Level threshold: –<br>Log directory size: 147 KB WC Pages<br><br>Shop base: #127 - /shop/<br>Cart: #128 - /cart/ - Contains the [woocommerce_cart] shortcode<br>Checkout: #195652 - /checkout/ - Contains the [woocommerce_checkout] shortcode<br>My account: #130 - /my-account/<br>Terms and conditions: #192518 - /terms-of-service/ Theme<br><br>Name: Sports Technology Labs<br>Version: 1.0<br>Author URL: https://github.com/theMugician<br>Child Theme: ? – If you are modifying WooCommerce on a parent theme that you did not build personally we recommend using a child theme. See: How to create a child theme<br>WooCommerce Support: ? Templates<br><br>Overrides: sportstechnologylabs/woocommerce/archive-product.php<br>sportstechnologylabs/woocommerce/cart/cart-shipping.php<br>sportstechnologylabs/woocommerce/cart/cart-totals.php<br>sportstechnologylabs/woocommerce/cart/cart.php<br>sportstechnologylabs/woocommerce/checkout/form-checkout.php<br>sportstechnologylabs/woocommerce/loop/header.php<br>sportstechnologylabs/woocommerce/single-product.php Admin<br><br>Enabled Features: activity-panels<br>analytics<br>product-block-editor<br>coupons<br>core-profiler<br>customize-store<br>customer-effort-score-tracks<br>import-products-task<br>experimental-fashion-sample-products<br>shipping-smart-defaults<br>shipping-setting-tour<br>homescreen<br>marketing<br>mobile-app-banner<br>navigation<br>onboarding<br>onboarding-tasks<br>pattern-toolkit-full-composability<br>product-custom-fields<br>remote-inbox-notifications<br>remote-free-extensions<br>payment-gateway-suggestions<br>printful<br>shipping-label-banner<br>subscriptions<br>store-alerts<br>transient-notices<br>woo-mobile-welcome<br>wc-pay-promotion<br>wc-pay-welcome-page<br>launch-your-store<br><br>Disabled Features: experimental-blocks<br>minified-js<br>product-pre-publish-modal<br>settings<br>async-product-editor-category-field<br>product-editor-template-system<br>blueprint<br>reactify-classic-payments-settings<br><br>Daily Cron: ? Next scheduled: 2024-11-02 18:10:04 +00:00<br>Options: ?<br>Notes: 70<br>Onboarding: completed Action Scheduler<br><br>Canceled: 3<br>Oldest: 2024-10-03 03:07:22 +0000<br>Newest: 2024-10-28 03:44:53 +0000<br><br>Complete: 6,794<br>Oldest: 2024-10-02 00:22:17 +0000<br>Newest: 2024-11-01 22:35:44 +0000<br><br>Failed: 16<br>Oldest: 2024-10-15 16:11:14 +0000<br>Newest: 2024-11-01 22:35:44 +0000<br><br>Pending: 6<br>Oldest: 2024-11-01 22:50:44 +0000<br>Newest: 2024-11-30 09:00:14 +0000 Status report information<br><br>Generated at: 2024-11-01 22:48:23 +00:00<br>
Hi @themugician,
Thanks for sharing your system status report with us.
When I first checked your SSR, I was able to notice the following:
Secure connection (HTTPS): ?
Your store is not using HTTPS. Learn more about HTTPS and SSL Certificates.Please ensure that your site is using HTTPS and a valid SSL certificate in your site. You can ask for further assistance with this from your host. While this might not be directly related to the current issue you’re facing, it may be a step towards identifying what could be leading to this issue.
Looking forward to your reply.
Hi @ckadenge
I ended up adding a ssl certificate so that SSL error is gone now.
However I get a JSON response error now
Hello @themugician,
I ended up adding a ssl certificate so that SSL error is gone now.
Glad to hear it.
However I get a JSON response error now
Please take a look at the steps shared in this article to see if the steps can help solve the issue you’re facing.
Let us know how it goes.
The JSON error went away
The main issue as to why the blocks weren’t rendering was because I wasn’t filtering the content in my
single.php
fileI changed
echo stl_table_of_contents( get_the_content() );
TO
echo stl_table_of_contents( apply_filters( 'the_content', get_the_content() ) );
The woocommerce blocks render on the frontend now
Hi @themugician,
The woocommerce blocks render on the frontend now
Glad to hear it – thanks for letting us know!
I’ll mark this thread as resolved now. If you have any further questions, I recommend creating a new thread.
- You must be logged in to reply to this topic.