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

Out of Stock products change stock to On Backorder when imported to update existing #19485

Closed
6 of 7 tasks
stephhjacq opened this issue Mar 22, 2018 · 7 comments
Closed
6 of 7 tasks
Assignees
Labels
type: bug The issue is a confirmed bug.
Milestone

Comments

@stephhjacq
Copy link

Prerequisites

  • I have searched for similar issues in both open and closed tickets and cannot find a duplicate
  • The issue still exists against the latest master branch of WooCommerce on Github (this is not the same version as on WordPress.org!)
  • I have attempted to find the simplest possible steps to reproduce the issue
  • I have included a failing test as a pull request (Optional)

Steps to reproduce the issue

  1. Export products using core WooCommerce CSV export. At least one product should be out of stock, with Allow backorders? set to Do not allow.
  2. Reimport products, select Update existing.

Expected/actual behavior

When I follow those steps, I see the product which was Out of Stock now shows as On backorder, even though Backorders is set to Do not allow in the product.

http://cld.wthms.co/XrN8vz
Full Image: http://cld.wthms.co/XrN8vz+

http://cld.wthms.co/HcAt8P
Full Image: http://cld.wthms.co/HcAt8P+

I was expecting to see: Product is reimported with same stock as no changes were made.

Isolating the problem

  • This bug happens with only WooCommerce plugin active
  • This bug happens with a default WordPress theme active, or Storefront
  • I can reproduce this bug consistently using the steps above

WordPress Environment

``` ### WordPress Environment ###

Home URL: https://nuoshoppe.mystagingwebsite.com
Site URL: https://nuoshoppe.mystagingwebsite.com
WC Version: 3.3.4
Log Directory Writable: ✔
WP Version: 4.9.4
WP Multisite: –
WP Memory Limit: 256 MB
WP Debug Mode: ✔
WP Cron: ✔
Language: en_US

Server Environment

Server Info: nginx
PHP Version: 7.0.28
PHP Post Max Size: 100 MB
PHP Time Limit: 300
PHP Max Input Vars: 6144
cURL Version: 7.58.0
OpenSSL/1.0.1t

SUHOSIN Installed: –
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.3.4
WC Database Prefix: wp_
MaxMind GeoIP Database: ✔
Total Database Size: 8.11MB
Database Data Size: 5.45MB
Database Index Size: 2.66MB
wp_woocommerce_sessions: Data: 0.02MB + 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.09MB + Index: 0.09MB
wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB
wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB
wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB
wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB
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_advanced_notifications: Data: 0.02MB + Index: 0.00MB
wp_advanced_notification_triggers: Data: 0.02MB + Index: 0.00MB
wp_commentmeta: Data: 0.02MB + 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.09MB + 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.05MB + 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_nf_objectmeta: Data: 0.02MB + Index: 0.00MB
wp_nf_objects: Data: 0.02MB + Index: 0.00MB
wp_nf_relationships: Data: 0.02MB + Index: 0.00MB
wp_ninja_forms_fav_fields: Data: 0.05MB + Index: 0.00MB
wp_ninja_forms_fields: Data: 0.02MB + Index: 0.00MB
wp_options: Data: 2.05MB + Index: 0.06MB
wp_postmeta: Data: 1.50MB + Index: 0.77MB
wp_posts: Data: 0.16MB + 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_wcpv_commissions: Data: 0.02MB + Index: 0.00MB
wp_wcpv_per_product_shipping_rules: Data: 0.02MB + Index: 0.00MB
wp_wc_booking_relationships: Data: 0.02MB + Index: 0.03MB
wp_wc_deposits_payment_plans: Data: 0.02MB + Index: 0.00MB
wp_wc_deposits_payment_plans_schedule: Data: 0.02MB + Index: 0.02MB
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_bundled_itemmeta: Data: 0.02MB + Index: 0.03MB
wp_woocommerce_bundled_items: Data: 0.02MB + Index: 0.03MB
wp_woocommerce_per_product_shipping_rules: Data: 0.02MB + Index: 0.00MB
wp_woocommerce_subscription_downloads: Data: 0.02MB + Index: 0.00MB
wp_wpml_mails: Data: 0.23MB + Index: 0.00MB

Post Type Counts

attachment: 29
bookable_person: 1
bookable_resource: 4
customize_changeset: 9
follow_up_email: 1
jetpack_migration: 2
jp_img_sitemap: 2
jp_sitemap: 2
jp_sitemap_master: 2
nav_menu_item: 7
page: 21
post: 1
product: 32
product_variation: 47
revision: 22
scheduled-action: 30
shipping_package: 1
shop_coupon: 15
shop_order: 41
shop_order_refund: 4
shop_subscription: 2
slide: 2
warranty_request: 2
wc_booking: 1
wc_membership_plan: 2
wishlist: 1

Security

Secure connection (HTTPS): ✔
Hide errors from visitors: ✔

Active Plugins (1)

WooCommerce: by Automattic – 3.3.4

Settings

API Enabled: ✔
Force SSL: ✔
Currency: USD ($)
Currency Position: left
Thousand Separator: ,
Decimal Separator: .
Number of Decimals: 2
Taxonomies: Product Types: booking (booking)
bundle (bundle)
external (external)
grouped (grouped)
photography (photography)
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)

WC Pages

Shop base: #5 - /shop/
Cart: #6 - /cart/
Checkout: #7 - /checkout/
My account: #8 - /my-account/
Terms and conditions: ❌ Page not set

Theme

Name: Storefront
Version: 2.2.8
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>
@kloon kloon self-assigned this Mar 23, 2018
@kloon kloon added the type: bug The issue is a confirmed bug. label Mar 23, 2018
@kloon kloon added this to the 3.3.5 milestone Mar 23, 2018
@kloon
Copy link
Member

kloon commented Mar 23, 2018

Can confirm this is a bug. Simply change a product to manage stock, set stock quantity to 0 and allow back order to no and then export, reimport file without any changes and the product changes to allow backorders.

@ontiuk
Copy link

ontiuk commented Mar 23, 2018

Confirmed. Importing 2000+ products from a dev site to live site (25k inc variations). Have the same settings as Kloon - manage stock, no backorder. Export & import. All zero stock products now showing as 'on backorder' although when in the variations UI panel it is showing as 'do not allow' backorder, which is the default select option. Seems to be an issue in setting the backorder setting. Frustrating.

Note, this is not as the title 'updating existing' this is for new imports, so likely an across all imports issue.

Looking at the meta data the _backorders key is set to blank instead of 'no', and the _stock_status to 'onbackorder' instead of 'outofstock'. Also noticed that the _download_limit is set to 0 instead of -1 and _download_expire to 0 from -1.

Also I have a couple of custom post_meta fields which are set at product level. These are correctly imported to the parent product for variant products, but also set as meta_data at the post_variation level - with blank values. These should not be imported to the variations.

This is an export from 3.2.6 to import 3.3.4.

@santanacostamarco
Copy link

I'm having the same problem on importing the products to create or update them, even when I change the "Allow backorder" to "no" or "0" or "false".

@mikejolley
Copy link
Member

The patch is above - it's not released yet.

@Risto87
Copy link

Risto87 commented Apr 14, 2018

I still have this problem after updating to 3.3.5, but only on variable products. Variations with stock qty 0 are all automatically set status "onbackorder", but they should all be "outofstock". We have thousands of products which are all imported and updated by daily basis and if we manually change the statuses to "outofstock" then in a while they are automatically changed back to "onbackorder" and we can't find a solution from anywhere.

onbackorder

@leekigogo
Copy link

i also still have this bug (WC 3.3.5) some products chance to "backorder" and i get every related E-Mail twice (Order E-Mail, out of stock etc.) this is very annoying. this happens moslty on orders when the customer pays via PayPal (not 100% sure)

@mikejolley
Copy link
Member

This issue was specific to the CSV importer in WooCommerce core - not other importers. If your importer is handling it wrongly you'll need to flag with whomever developed it. If it's the core importers, log a new issue with example CSV to reproduce the issue.

@woocommerce woocommerce locked as resolved and limited conversation to collaborators Apr 16, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug The issue is a confirmed bug.
Projects
None yet
Development

No branches or pull requests

7 participants