-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Description
Describe the bug
When the "Hide out of stock items from the catalog" option is selected, products with attributes that are out of stock will still show in search results for the "Filter by Attribute" widget.
To Reproduce
Steps to reproduce the behavior:
- Go to
WooCommerce > Settings > Products > Inventoryand enable the "Hide out of stock items from the catalog" option. - Create a variable product and make one of the attributes completely "Out of Stock"
- Enable the "Filter by Attribute" widget
- Use the "Filter by Attribute" widget to search for that specific attribute
- The product with the attribute options that are "out of stock" will still display in search results.
Screenshots
When the following is selected:
Image link: http://cld.wthms.co/nwuRmo
The "Filter by Attribute" widget will still return products that have those specific attributes/variation options "Out of Stock".
For example: This product has both Black and Blue color options along with size. I've made sure all Black options are currently "Out of Stock":
Screencast link: http://cld.wthms.co/TXu5oQ
This hides them on the product page, which is good. However, if I use the "Filter by Attribute" widget on any shop or product archive pages, the product will still display, even thought the "Black" option is out of stock.
Screencast: http://cld.wthms.co/dhyktv
Expected behavior
That any "Out of Stock" variations/attributes for products are also hidden by the "Filter by Attribute" widget search results when the option here is selected:
Image link: http://cld.wthms.co/nwuRmo
Isolating the problem (mark completed items with an [x]):
- 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.
WordPress Environment
Server Environment
Server Info: nginx
PHP Version: 7.0.30 - We recommend using PHP version 7.2 or above for greater performance and security. How to update your PHP version
PHP Post Max Size: 100 MB
PHP Time Limit: 300
PHP Max Input Vars: 6144
cURL Version: 7.59.0
OpenSSL/1.0.1t
SUHOSIN Installed: –
MySQL Version: 5.5.5-10.1.17-MariaDB
Max Upload Size: 100 MB
Default Timezone is UTC: ✔
fsockopen/cURL: ✔
SoapClient: ✔
DOMDocument: ✔
GZip: ✔
Multibyte String: ✔
Remote Post: ✔
Remote Get: ✔
Database
WC Database Version: 3.4.3
WC Database Prefix: wp_
MaxMind GeoIP Database: ✔
Total Database Size: 6.60MB
Database Data Size: 4.27MB
Database Index Size: 2.33MB
wp_woocommerce_sessions: Data: 0.06MB + Index: 0.02MB
wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB
wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB
wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.05MB
wp_woocommerce_order_items: Data: 0.02MB + Index: 0.02MB
wp_woocommerce_order_itemmeta: Data: 0.08MB + Index: 0.06MB
wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB
wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.05MB
wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB
wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.05MB
wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB
wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB
wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB
wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB
wp_commentmeta: Data: 0.06MB + Index: 0.03MB
wp_comments: Data: 0.06MB + Index: 0.09MB
wp_followup_coupons: Data: 0.02MB + Index: 0.03MB
wp_followup_coupon_logs: Data: 0.02MB + Index: 0.03MB
wp_followup_customers: Data: 0.02MB + Index: 0.06MB
wp_followup_customer_carts: Data: 0.02MB + Index: 0.03MB
wp_followup_customer_notes: Data: 0.02MB + Index: 0.03MB
wp_followup_customer_orders: Data: 0.02MB + Index: 0.02MB
wp_followup_email_coupons: Data: 0.02MB + Index: 0.02MB
wp_followup_email_excludes: Data: 0.02MB + Index: 0.05MB
wp_followup_email_logs: Data: 0.02MB + Index: 0.05MB
wp_followup_email_orders: Data: 0.16MB + Index: 0.09MB
wp_followup_email_order_coupons: Data: 0.02MB + Index: 0.02MB
wp_followup_email_tracking: Data: 0.02MB + Index: 0.08MB
wp_followup_followup_history: Data: 0.02MB + Index: 0.05MB
wp_followup_order_categories: Data: 0.02MB + Index: 0.03MB
wp_followup_order_items: Data: 0.02MB + Index: 0.05MB
wp_followup_subscribers: Data: 0.02MB + Index: 0.03MB
wp_followup_subscribers_to_lists: Data: 0.02MB + Index: 0.03MB
wp_followup_subscriber_lists: Data: 0.02MB + Index: 0.03MB
wp_links: Data: 0.02MB + Index: 0.02MB
wp_options: Data: 1.17MB + Index: 0.05MB
wp_postmeta: Data: 1.50MB + Index: 0.50MB
wp_posts: Data: 0.25MB + Index: 0.06MB
wp_termmeta: Data: 0.02MB + Index: 0.03MB
wp_terms: Data: 0.02MB + Index: 0.03MB
wp_term_relationships: Data: 0.02MB + Index: 0.02MB
wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB
wp_usermeta: Data: 0.05MB + Index: 0.03MB
wp_users: Data: 0.02MB + Index: 0.05MB
wp_wc_booking_relationships: Data: 0.02MB + Index: 0.03MB
wp_wc_download_log: Data: 0.02MB + Index: 0.03MB
wp_wc_points_rewards_user_points: Data: 0.02MB + Index: 0.03MB
wp_wc_points_rewards_user_points_log: Data: 0.02MB + Index: 0.05MB
wp_wc_warranty_products: Data: 0.02MB + Index: 0.05MB
wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB
wp_woocommerce_per_product_shipping_rules: Data: 0.02MB + Index: 0.00MB
wp_yoast_seo_links: Data: 0.02MB + Index: 0.02MB
wp_yoast_seo_meta: Data: 0.02MB + Index: 0.00MB
Post Type Counts
attachment: 62
custom_css: 1
customize_changeset: 15
jetpack_migration: 2
jp_img_sitemap: 2
jp_sitemap: 2
jp_sitemap_master: 2
nav_menu_item: 7
page: 13
post: 2
product: 53
product_variation: 56
revision: 31
scheduled-action: 91
shop_coupon: 4
shop_order: 39
slide: 1
Security
Secure connection (HTTPS): ✔
Hide errors from visitors: ✔
Active Plugins (2)
WooCommerce PayPal Checkout Gateway: by WooCommerce – 1.6.1
WooCommerce: by Automattic – 3.4.3
Settings
API Enabled: ✔
Force SSL: ✔
Currency: USD ($)
Currency Position: left
Thousand Separator: ,
Decimal Separator: .
Number of Decimals: 2
Taxonomies: Product Types: booking (booking)
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)
WC Pages
Shop base: #3 - /shop/
Cart: #4 - /cart/
Checkout: #5 - /checkout/
My account: #6 - /my-account/
Terms and conditions: #312 - /terms-conditions/
Theme
Name: Storefront
Version: 2.3.2
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: –
`
</details>