Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Product Collection: Fatal error adding product-stock-indicator block within product-collection template #44225

Closed
5 tasks done
domegang opened this issue Jan 31, 2024 · 2 comments · Fixed by #45135
Closed
5 tasks done
Labels
block: product collection Issues related to the Product Collection block block-type: product elements Issues related to Product Element blocks. focus: FSE Issues related to Full Site Editing team: Kirigami & Origami type: community contribution

Comments

@domegang
Copy link

domegang commented Jan 31, 2024

Prerequisites

  • I have carried out troubleshooting steps and I believe I have found a bug.
  • I have searched for similar bugs in both open and closed issues and cannot find a duplicate.

Describe the bug

Environments: Local-wp
Theme: Twenty Twenty Four FSE

I added the 'product-collection' block to the homepage without making any modifications. Additionally, I inserted a 'group' block containing the 'product-price' and 'product-stock-indicator' blocks inside the default product-template.

Expected behavior

An horizontal div with price and stock availability.

Actual behavior

Fatal error: Uncaught Error: Call to a member function is_in_stock() on bool in website-directory/app/public/wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductStockIndicator.php:89 Stack trace: #0 website-directory/app/public/wp-content/plugins/woocommerce/src/Blocks/BlockTypes/AbstractBlock.php(88): Automattic\WooCommerce\Blocks\BlockTypes\ProductStockIndicator->render(Array, '', Object(WP_Block)) #1 website-directory/app/public/wp-includes/class-wp-block.php(258): Automattic\WooCommerce\Blocks\BlockTypes\AbstractBlock->render_callback(Array, '', Object(WP_Block)) #2 website-directory/app/public/wp-includes/class-wp-block.php(244): WP_Block->render() #3 website-directory/app/public/wp-includes/class-wp-block.php(244): WP_Block->render() #4 website-directory/app/public/wp-includes/class-wp-block.php(244): WP_Block->render() #5 website-directory/app/public/wp-includes/class-wp-block.php(244): WP_Block->render() #6 website-directory/app/public/wp-includes/class-wp-block.php(244): WP_Block->render() #7 website-directory/app/public/wp-includes/class-wp-block.php(244): WP_Block->render() #8 website-directory/app/public/wp-includes/blocks.php(1484): WP_Block->render() #9 website-directory/app/public/wp-includes/blocks.php(1522): render_block(Array) #10 website-directory/app/public/wp-includes/block-template.php(263): do_blocks('<!-- wp:templat...') #11 website-directory/app/public/wp-includes/template-canvas.php(12): get_the_block_template_html() #12 website-directory/app/public/wp-includes/template-loader.php(106): include('/Users/.....') #13 website-directory/app/public/wp-blog-header.php(19): require_once('/Users/.....') #14 website-directory/app/public/index.php(17): require('/Users/.....') #15 {main} thrown in website-directory/app/public/wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductStockIndicator.php on line 89

Steps to reproduce

WordPress Environment

`

WordPress Environment

WordPress address (URL): http://localhost:10124
Site address (URL): http://localhost:10124
WC Version: 8.5.2
REST API Version: ✔ 8.5.2
WC Blocks Version: ✔ 11.8.0-dev
Action Scheduler Version: ✔ 3.7.1
Log Directory Writable: ✔
WP Version: 6.4.3
WP Multisite: –
WP Memory Limit: 256 MB
WP Debug Mode: ✔
WP Cron: ✔
Language: it_IT
External object cache: –

Server Environment

Server Info: nginx/1.16.0
PHP Version: 8.1.23
PHP Post Max Size: 1.000 MB
PHP Time Limit: 1200
PHP Max Input Vars: 4000
cURL Version: 7.79.1
(SecureTransport) LibreSSL/3.3.5

SUHOSIN Installed: –
MySQL Version: 8.0.16
Max Upload Size: 300 MB
Default Timezone is UTC: ✔
fsockopen/cURL: ✔
SoapClient: ✔
DOMDocument: ✔
GZip: ✔
Multibyte String: ✔
Remote Post: ✔
Remote Get: ✔

Database

WC Database Version: 8.5.2
WC Database Prefix: wp_
Dimensione totale database: 14.41MB
Dimensione dati database: 12.14MB
Dimensione indice database: 2.27MB
wp_woocommerce_sessions: Dati: 0.02MB + indice: 0.02MB + motore InnoDB
wp_woocommerce_api_keys: Dati: 0.02MB + indice: 0.03MB + motore InnoDB
wp_woocommerce_attribute_taxonomies: Dati: 0.02MB + indice: 0.02MB + motore InnoDB
wp_woocommerce_downloadable_product_permissions: Dati: 0.02MB + indice: 0.06MB + motore InnoDB
wp_woocommerce_order_items: Dati: 0.02MB + indice: 0.02MB + motore InnoDB
wp_woocommerce_order_itemmeta: Dati: 0.02MB + indice: 0.03MB + motore InnoDB
wp_woocommerce_tax_rates: Dati: 0.02MB + indice: 0.06MB + motore InnoDB
wp_woocommerce_tax_rate_locations: Dati: 0.02MB + indice: 0.03MB + motore InnoDB
wp_woocommerce_shipping_zones: Dati: 0.02MB + indice: 0.00MB + motore InnoDB
wp_woocommerce_shipping_zone_locations: Dati: 0.02MB + indice: 0.03MB + motore InnoDB
wp_woocommerce_shipping_zone_methods: Dati: 0.02MB + indice: 0.00MB + motore InnoDB
wp_woocommerce_payment_tokens: Dati: 0.02MB + indice: 0.02MB + motore InnoDB
wp_woocommerce_payment_tokenmeta: Dati: 0.02MB + indice: 0.03MB + motore InnoDB
wp_woocommerce_log: Dati: 0.02MB + indice: 0.02MB + motore InnoDB
wp_actionscheduler_actions: Dati: 0.05MB + indice: 0.11MB + motore InnoDB
wp_actionscheduler_claims: Dati: 0.02MB + indice: 0.02MB + motore InnoDB
wp_actionscheduler_groups: Dati: 0.02MB + indice: 0.02MB + motore InnoDB
wp_actionscheduler_logs: Dati: 0.02MB + indice: 0.03MB + motore InnoDB
wp_commentmeta: Dati: 0.02MB + indice: 0.03MB + motore InnoDB
wp_comments: Dati: 0.02MB + indice: 0.08MB + motore InnoDB
wp_duplicator_packages: Dati: 0.02MB + indice: 0.02MB + motore InnoDB
wp_links: Dati: 0.02MB + indice: 0.02MB + motore InnoDB
wp_options: Dati: 4.02MB + indice: 0.11MB + motore InnoDB
wp_postmeta: Dati: 1.50MB + indice: 0.16MB + motore InnoDB
wp_posts: Dati: 5.47MB + indice: 0.22MB + motore InnoDB
wp_redirection_404: Dati: 0.02MB + indice: 0.05MB + motore InnoDB
wp_redirection_groups: Dati: 0.02MB + indice: 0.03MB + motore InnoDB
wp_redirection_items: Dati: 0.02MB + indice: 0.09MB + motore InnoDB
wp_redirection_logs: Dati: 0.02MB + indice: 0.05MB + motore InnoDB
wp_term_relationships: Dati: 0.02MB + indice: 0.02MB + motore InnoDB
wp_term_taxonomy: Dati: 0.02MB + indice: 0.03MB + motore InnoDB
wp_termmeta: Dati: 0.02MB + indice: 0.03MB + motore InnoDB
wp_terms: Dati: 0.02MB + indice: 0.03MB + motore InnoDB
wp_usermeta: Dati: 0.02MB + indice: 0.03MB + motore InnoDB
wp_users: Dati: 0.02MB + indice: 0.05MB + motore InnoDB
wp_wc_admin_note_actions: Dati: 0.06MB + indice: 0.02MB + motore InnoDB
wp_wc_admin_notes: Dati: 0.06MB + indice: 0.00MB + motore InnoDB
wp_wc_category_lookup: Dati: 0.02MB + indice: 0.00MB + motore InnoDB
wp_wc_customer_lookup: Dati: 0.02MB + indice: 0.03MB + motore InnoDB
wp_wc_download_log: Dati: 0.02MB + indice: 0.03MB + motore InnoDB
wp_wc_order_addresses: Dati: 0.02MB + indice: 0.06MB + motore InnoDB
wp_wc_order_coupon_lookup: Dati: 0.02MB + indice: 0.03MB + motore InnoDB
wp_wc_order_operational_data: Dati: 0.02MB + indice: 0.03MB + motore InnoDB
wp_wc_order_product_lookup: Dati: 0.02MB + indice: 0.06MB + motore InnoDB
wp_wc_order_stats: Dati: 0.02MB + indice: 0.05MB + motore InnoDB
wp_wc_order_tax_lookup: Dati: 0.02MB + indice: 0.03MB + motore InnoDB
wp_wc_orders: Dati: 0.02MB + indice: 0.11MB + motore InnoDB
wp_wc_orders_meta: Dati: 0.02MB + indice: 0.03MB + motore InnoDB
wp_wc_product_attributes_lookup: Dati: 0.02MB + indice: 0.02MB + motore InnoDB
wp_wc_product_download_directories: Dati: 0.02MB + indice: 0.02MB + motore InnoDB
wp_wc_product_meta_lookup: Dati: 0.02MB + indice: 0.09MB + motore InnoDB
wp_wc_rate_limits: Dati: 0.02MB + indice: 0.02MB + motore InnoDB
wp_wc_reserved_stock: Dati: 0.02MB + indice: 0.00MB + motore InnoDB
wp_wc_tax_rate_classes: Dati: 0.02MB + indice: 0.02MB + motore InnoDB
wp_wc_webhooks: Dati: 0.02MB + indice: 0.02MB + motore InnoDB

Post Type Counts

attachment: 409
customize_changeset: 1
oembed_cache: 1
page: 11
post: 82
product: 17
revision: 420
shop_order_placehold: 1
wp_global_styles: 2
wp_navigation: 1
wp_template: 14
wp_template_part: 4

Security

Secure connection (HTTPS): ❌
Il tuo negozio non utilizza HTTPS. Scopri di più su HTTPS e certificati SSL .
Hide errors from visitors: ❌I messaggi di errore non saranno mostrati ai visitatori.

Active Plugins (6)

Carousel Slider Block for Gutenberg: by – 1.0.10
Duplicator: by Duplicator – 1.5.8
Lightbox with PhotoSwipe: by Arno Welzel – 5.1.6
Lyriks Product Attributo Autore: by Domenico Gangemi – 0.1.0
Redirection: by John Godley – 5.4.2
WooCommerce: by Automattic – 8.5.2

Inactive Plugins (0)

Settings

API Enabled: –
Force SSL: –
Currency: EUR (€)
Currency Position: right_space
Thousand Separator: .
Decimal Separator: ,
Number of Decimals: 2
Taxonomies: Product Types: external (external)
grouped (grouped)
simple (simple)
variable (variable)

Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog)
exclude-from-search (exclude-from-search)
featured (featured)
outofstock (outofstock)
rated-1 (rated-1)
rated-2 (rated-2)
rated-3 (rated-3)
rated-4 (rated-4)
rated-5 (rated-5)

Connected to Woo.com: –
Enforce Approved Product Download Directories: ✔
HPOS feature screen enabled: ✔
HPOS feature enabled: ✔
Order datastore: Automattic\WooCommerce\Internal\DataStores\Orders\OrdersTableDataStore
HPOS data sync enabled: –

WC Pages

Shop base: #11 - /shop/
Carrello: #12 - /carrello/
Pagamento: #13 - /checkout/
Il mio account: #14 - /il-mio-account/
Termini e condizioni: ❌ La pagina non è impostata

Theme

Name: LYRIKS
Version: 1.0
Author URL:
Child Theme: ✔
Parent Theme Name: Twenty Twenty-Four
Parent Theme Version: 1.0
Parent Theme Author URL: https://wordpress.org
WooCommerce Support: ❌ Non dichiarato

Templates

Overrides: –

Admin

Enabled Features: activity-panels
analytics
product-block-editor
coupons
core-profiler
customer-effort-score-tracks
import-products-task
experimental-fashion-sample-products
shipping-smart-defaults
shipping-setting-tour
homescreen
marketing
mobile-app-banner
navigation
onboarding
onboarding-tasks
product-variation-management
product-virtual-downloadable
product-external-affiliate
product-grouped
remote-inbox-notifications
remote-free-extensions
payment-gateway-suggestions
shipping-label-banner
subscriptions
store-alerts
transient-notices
woo-mobile-welcome
wc-pay-promotion
wc-pay-welcome-page

Disabled Features: customize-store
minified-js
new-product-management-experience
product-linked
settings
async-product-editor-category-field

Daily Cron: ✔ Next scheduled: 2024-01-31 15:43:44 +01:00
Options: ✔
Notes: 69
Onboarding: skipped

Action Scheduler

Completato: 79
Oldest: 2024-01-23 16:43:47 +0100
Newest: 2024-01-31 13:12:21 +0100

Operazione non riuscita: 1
Oldest: 2024-01-23 16:50:44 +0100
Newest: 2024-01-23 16:50:44 +0100

In attesa: 1
Oldest: 2024-02-01 13:12:21 +0100
Newest: 2024-02-01 13:12:21 +0100

Status report information

Generated at: 2024-01-31 13:22:20 +01:00
`

Isolating the problem

  • I have deactivated other plugins and confirmed this bug occurs when only WooCommerce plugin is active.
  • This bug happens with a default WordPress theme active, or Storefront.
  • I can reproduce this bug consistently using the steps above.
@rrennick rrennick added team: Kirigami & Origami focus: FSE Issues related to Full Site Editing labels Feb 1, 2024
@kmanijak kmanijak added the block: product collection Issues related to the Product Collection block label Feb 26, 2024
@kmanijak
Copy link
Contributor

Hi @domegang!

Thanks for reporting this issue. I could reproduce it and already prepared a fix: #45135. Please follow the PR for further updates but I appreciate time to report this issue! 🙌

@domegang
Copy link
Author

hello @kmanijak
I'm happy to have contributed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
block: product collection Issues related to the Product Collection block block-type: product elements Issues related to Product Element blocks. focus: FSE Issues related to Full Site Editing team: Kirigami & Origami type: community contribution
Projects
None yet
3 participants