Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Notices for variations without prices #2714

Closed
peterfabian opened this issue Jun 15, 2020 · 2 comments · Fixed by #2722
Closed

Notices for variations without prices #2714

peterfabian opened this issue Jun 15, 2020 · 2 comments · Fixed by #2722
Assignees
Labels
block: all products Issues related to the all products block. focus: rest api Work impacting REST api routes. type: bug The issue/PR concerns a confirmed bug.
Milestone

Comments

@peterfabian
Copy link

Describe the bug
Getting the following notices for variable products that don't have prices on variations defined:

PHP Warning: min(): Array must contain at least one element in /srv/www/wordpress-one/public_html/wp-content/plugins/woocommerce/packages/woocommerce-blocks/src/StoreApi/Schemas/ProductSchema.php on line 357
PHP Warning: max(): Array must contain at least one element in /srv/www/wordpress-one/public_html/wp-content/plugins/woocommerce/packages/woocommerce-blocks/src/StoreApi/Schemas/ProductSchema.php on line 357
PHP Warning: A non-numeric value encountered in /srv/www/wordpress-one/public_html/wp-content/plugins/woocommerce/packages/woocommerce-blocks/src/StoreApi/Schemas/AbstractSchema.php on line 243

To Reproduce
Steps to reproduce the behavior:

  1. Create a variable product with a couple of variations, don't set prices on them.
  2. Add Filter Products by Price block (I used it with All Products)
  3. Check PHP error log
  4. See warnings as above

Expected behavior
No warnings.

WordPress (please complete the following information):

  • Core version: 5.4.1
  • WooCommerce version: master
  • WooCommerce Blocks version: 2.7.0
  • Site language: en_US
  • Any other plugins installed:
system status report ` ### WordPress Environment ###

WordPress address (URL): http://one.wordpress.test
Site address (URL): http://one.wordpress.test
WC Version: 4.3.0
REST API Version: ✔ 1.1.0
WC Blocks Version: ✔ 2.7.0
Action Scheduler Version: ✔ 3.1.6
WC Admin Version: ✔ 1.2.3
Log Directory Writable: ✔
WP Version: ❌ 5.4.1 - There is a newer version of WordPress available (5.4.2)
WP Multisite: –
WP Memory Limit: 256 MB
WP Debug Mode: ✔
WP Cron: ✔
Language: en_US
External object cache: –

Server Environment

Server Info: nginx/1.17.10
PHP Version: 7.4.6
PHP Post Max Size: 1 GB
PHP Time Limit: 0
PHP Max Input Vars: 1000
cURL Version: 7.58.0
OpenSSL/1.1.1d

SUHOSIN Installed: –
MySQL Version: 5.5.5-10.3.23-MariaDB-1:10.3.23+maria~bionic
Max Upload Size: 1 GB
Default Timezone is UTC: ✔
fsockopen/cURL: ✔
SoapClient: ✔
DOMDocument: ✔
GZip: ✔
Multibyte String: ✔
Remote Post: ✔
Remote Get: ✔

Database

WC Database Version: 4.1.0
WC Database Prefix: wp_
Total Database Size: 25.85MB
Database Data Size: 15.26MB
Database Index Size: 10.59MB
wp_woocommerce_sessions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
wp_woocommerce_order_items: Data: 0.28MB + Index: 0.13MB + Engine InnoDB
wp_woocommerce_order_itemmeta: Data: 2.52MB + Index: 3.03MB + Engine InnoDB
wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wctracker_snapshots: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_actionscheduler_actions: Data: 1.02MB + Index: 0.48MB + Engine InnoDB
wp_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_actionscheduler_logs: Data: 1.02MB + Index: 0.28MB + Engine InnoDB
wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_comments: Data: 0.16MB + Index: 0.16MB + Engine InnoDB
wp_gf_draft_submissions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_gf_entry: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_gf_entry_meta: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
wp_gf_entry_notes: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_gf_form: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_gf_form_meta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_gf_form_revisions: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_gf_form_view: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_mailchimp_carts: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_mailchimp_jobs: Data: 0.22MB + Index: 0.00MB + Engine InnoDB
wp_options: Data: 3.06MB + Index: 0.08MB + Engine InnoDB
wp_postmeta: Data: 3.52MB + Index: 4.03MB + Engine InnoDB
wp_posts: Data: 1.52MB + Index: 0.28MB + Engine InnoDB
wp_termmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_term_relationships: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_usermeta: Data: 0.39MB + Index: 0.44MB + Engine InnoDB
wp_users: Data: 0.05MB + Index: 0.05MB + Engine InnoDB
wp_wc_admin_notes: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wc_admin_note_actions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wc_customer_lookup: Data: 0.06MB + Index: 0.03MB + Engine InnoDB
wp_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_wc_order_product_lookup: Data: 0.42MB + Index: 0.53MB + Engine InnoDB
wp_wc_order_stats: Data: 0.09MB + Index: 0.05MB + Engine InnoDB
wp_wc_order_tax_lookup: Data: 0.08MB + Index: 0.06MB + Engine InnoDB
wp_wc_product_meta_lookup: Data: 0.09MB + Index: 0.13MB + Engine InnoDB
wp_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB

Post Type Counts

attachment: 93
page: 16
post: 6
product: 99
product_variation: 512
revision: 41
shop_coupon: 8
shop_order: 647
shop_order_refund: 6

Security

Secure connection (HTTPS): ❌
Your store is not using HTTPS. Learn more about HTTPS and SSL Certificates.
Hide errors from visitors: ✔

Active Plugins (8)

Query Monitor: by John Blackbourn – 3.6.0
Disable XML-RPC: by Philip Erb – 1.0.1
Facebook for WooCommerce: by Facebook – 1.11.3 – Installed version not tested with active version of WooCommerce 4.3.0
Mailchimp for WooCommerce: by Mailchimp – 2.4.0 – Installed version not tested with active version of WooCommerce 4.3.0
RTL Tester: by Yoav Farhi
Automattic – 1.2

WooCommerce Stripe Gateway: by WooCommerce – 4.4.0 – Installed version not tested with active version of WooCommerce 4.3.0
WooCommerce REST API: by Automattic – 1.1.0 – Installed version not tested with active version of WooCommerce 4.3.0
WooCommerce: by Automattic – 4.3.0-dev

Inactive Plugins (10)

Jetpack by WordPress.com: by Automattic – 8.5
Variation Swatches for WooCommerce: by Emran Ahmed – 1.0.82 – Installed version not tested with active version of WooCommerce 4.3.0
W3 Total Cache: by BoldGrid – 0.14.1
WooCommerce - ShipStation Integration: by WooCommerce – 4.1.36 (update to version 4.1.37 is available) – Installed version not tested with active version of WooCommerce 4.3.0
WooCommerce PayPal Checkout Gateway: by WooCommerce – 2.0.2 – Installed version not tested with active version of WooCommerce 4.3.0
WooCommerce PayPal Powered by Braintree Gateway: by WooCommerce – 2.3.10 (update to version 2.3.11 is available) – Installed version not tested with active version of WooCommerce 4.3.0
WooCommerce Services: by Automattic – 1.23.0 (update to version 1.23.2 is available) – Installed version not tested with active version of WooCommerce 4.3.0
WooCommerce Smooth Generator: by Automattic – 1.0.0 – Installed version not tested with active version of WooCommerce 4.3.0
WooCommerce Subscriptions: by Automattic – 2.6.5 – Installed version not tested with active version of WooCommerce 4.3.0
WP Crontrol: by John Blackbourn & crontributors – 1.8.3

Dropin Plugins (1)

db.php: Query Monitor Database Class

Settings

API Enabled: –
Force SSL: –
Currency: GBP (£)
Currency Position: left
Thousand Separator: ,
Decimal Separator: .
Number of Decimals: 2
Taxonomies: Product Types: external (external)
grouped (grouped)
simple (simple)
subscription (subscription)
variable (variable)
variable subscription (variable-subscription)

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 WooCommerce.com: –

WC Pages

Shop base: #1736 - /svg-onloadalertxss-svg/
Cart: #7 - /cart/
Checkout: #8 - /checkout/
My account: #9 - /my-account/
Terms and conditions: ❌ Page not set

Theme

Name: Storefront
Version: 2.5.3 (update to version 2.5.7 is available)
Author URL: https://woocommerce.com/
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
WooCommerce Support: ✔

Templates

Overrides: storefront/woocommerce/emails/admin-new-order.php

Action Scheduler

Canceled: 11
Oldest: 2020-05-29 10:21:03 +0000
Newest: 2020-05-29 10:21:03 +0000

Complete: 1,497
Oldest: 2020-05-29 10:21:07 +0000
Newest: 2020-06-15 12:18:51 +0000

Pending: 2
Oldest: 2020-06-15 13:18:51 +0000
Newest: 2020-06-16 08:17:31 +0000

`

@Aljullu Aljullu added the type: bug The issue/PR concerns a confirmed bug. label Jun 15, 2020
@Aljullu
Copy link
Contributor

Aljullu commented Jun 15, 2020

Thanks for filling this issue @peterfabian. I can reproduce it as well, it seems to be similar as: #2578.

Given that this is a regression from 2.5.x, should we add it to the 2.7.1 scope @nerrad?

@Aljullu Aljullu added focus: rest api Work impacting REST api routes. block: all products Issues related to the all products block. labels Jun 15, 2020
@nerrad
Copy link
Contributor

nerrad commented Jun 15, 2020

Given that this is a regression from 2.5.x, should we add it to the 2.7.1 scope @nerrad?

Yes.

@nerrad nerrad added this to the 2.7.1 milestone Jun 15, 2020
@nerrad nerrad self-assigned this Jun 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
block: all products Issues related to the all products block. focus: rest api Work impacting REST api routes. type: bug The issue/PR concerns a confirmed bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants