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

Trying to import a variable product but it ends up with term_taxonomy_id of a simple product. #18765

Closed
6 of 7 tasks
johnlmccurdy opened this issue Feb 1, 2018 · 6 comments
Closed
6 of 7 tasks

Comments

@johnlmccurdy
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

When I import a variable product with wp all import (or with the built in importer) and when I go to check the product in the products admin panel, the product displays as a simple product. If I then manually select variable product and click on the variations tab, all the variations are imported correctly. They all have variation enabled checkbox ticked and if I then conclude this by clicking the update button, it renders on the front end correctly as a variable product.

The reason, this is an issue it that we have a cron job set up to refresh prices and inventory on these products each night. It doesn't work with out further manual intervention to re-set the products as variables and not as a simple products.

Expected/actual behavior

Normally, I expect to see the product imported as a variable product.

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

In isolating the problem, I have tried with de-activated all plugins and themes (I used the 2017 theme) (except for those needed to import the product.) I have other woocommerce stores on the same server, on the same theme, with the same plugins that don't have this issue. I have narrowed it down to the wp_term_relationships table in the database. When I look at one of the faulty imports, it has a term_taxonomy_id of 4 and also of 6 (4 being simple product and 6 being a variable product). This conflict seems to be the issue. Other products that existed before the issue started happening have only an ID of 6. When I do this import on my other sites, again, the ID is only 6 and there is no 4 present.

I have been through all possible combinations of plugins active, de-active, restored databases from 1 month ago, restored files from different time points etc etc. The issue is always the same.

I can not think of anything else except that there is a database issue / corrupt piece of code in woocommerce that is causing the import to assign both the ID for a simple and variable product. Please help!

WordPress Environment

` ### WordPress Environment ###

Home URL: https://discovergrandprix.com
Site URL: https://discovergrandprix.com
WC Version: 3.2.6
Log Directory Writable: ✔
WP Version: 4.9.2
WP Multisite: –
WP Memory Limit: 768 MB
WP Debug Mode: –
WP Cron: ✔
Language: en_GB

Server Environment

Server Info: Apache
PHP Version: 7.0.27
PHP Post Max Size: 128 MB
PHP Time Limit: 1800
PHP Max Input Vars: 3000
cURL Version: 7.53.0
OpenSSL/1.0.2k

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

Database

WC Database Version: 3.2.6
WC Database Prefix: wp_
Total Database Size: 29.24MB
Database Data Size: 25.64MB
Database Index Size: 3.60MB
wp_woocommerce_sessions: Data: 0.03MB + Index: 0.00MB
wp_woocommerce_api_keys: Data: 0.00MB + Index: 0.01MB
wp_woocommerce_attribute_taxonomies: Data: 0.00MB + Index: 0.01MB
wp_woocommerce_downloadable_product_permissions: Data: 0.00MB + Index: 0.01MB
wp_woocommerce_order_items: Data: 0.00MB + Index: 0.00MB
wp_woocommerce_order_itemmeta: Data: 0.01MB + Index: 0.02MB
wp_woocommerce_tax_rates: Data: 0.00MB + Index: 0.01MB
wp_woocommerce_tax_rate_locations: Data: 0.00MB + Index: 0.00MB
wp_woocommerce_shipping_zones: Data: 0.00MB + Index: 0.00MB
wp_woocommerce_shipping_zone_locations: Data: 0.00MB + Index: 0.01MB
wp_woocommerce_shipping_zone_methods: Data: 0.00MB + Index: 0.00MB
wp_woocommerce_payment_tokens: Data: 0.00MB + Index: 0.00MB
wp_woocommerce_payment_tokenmeta: Data: 0.00MB + Index: 0.01MB
wp_woocommerce_log: Data: 0.00MB + Index: 0.00MB
wp_apsl_users_social_profile_details: Data: 0.02MB + Index: 0.03MB
wp_commentmeta: Data: 0.37MB + Index: 0.02MB
wp_comments: Data: 0.02MB + Index: 0.02MB
wp_failed_jobs: Data: 12.46MB + Index: 0.64MB
wp_hotel_room: Data: 0.00MB + Index: 0.00MB
wp_inbound_events: Data: 0.00MB + Index: 0.00MB
wp_inbound_page_views: Data: 0.00MB + Index: 0.00MB
wp_inbound_tracked_links: Data: 0.00MB + Index: 0.00MB
wp_links: Data: 0.00MB + Index: 0.00MB
wp_mailchimp_carts: Data: 0.00MB + Index: 0.00MB
wp_options: Data: 0.88MB + Index: 0.14MB
wp_pmxe_exports: Data: 0.02MB + Index: 0.00MB
wp_pmxe_google_cats: Data: 0.26MB + Index: 0.05MB
wp_pmxe_posts: Data: 0.00MB + Index: 0.00MB
wp_pmxe_templates: Data: 0.00MB + Index: 0.00MB
wp_pmxi_files: Data: 0.00MB + Index: 0.00MB
wp_pmxi_history: Data: 0.01MB + Index: 0.01MB
wp_pmxi_imports: Data: 0.08MB + Index: 0.00MB
wp_pmxi_posts: Data: 0.01MB + Index: 0.00MB
wp_pmxi_templates: Data: 0.13MB + Index: 0.00MB
wp_postmeta: Data: 7.78MB + Index: 0.68MB
wp_posts: Data: 1.13MB + Index: 0.71MB
wp_po_plugins: Data: 0.40MB + Index: 0.13MB
wp_queue: Data: 0.01MB + Index: 0.00MB
wp_redirection_404: Data: 1.52MB + Index: 0.59MB
wp_redirection_groups: Data: 0.02MB + Index: 0.03MB
wp_redirection_items: Data: 0.02MB + Index: 0.08MB
wp_redirection_logs: Data: 0.02MB + Index: 0.08MB
wp_smush_dir_images: Data: 0.00MB + Index: 0.00MB
wp_social_users: Data: 0.02MB + Index: 0.02MB
wp_st_activity: Data: 0.00MB + Index: 0.00MB
wp_st_availability: Data: 0.00MB + Index: 0.00MB
wp_st_cars: Data: 0.00MB + Index: 0.00MB
wp_st_hotel: Data: 0.00MB + Index: 0.00MB
wp_st_location_nested: Data: 0.00MB + Index: 0.00MB
wp_st_location_relationships: Data: 0.00MB + Index: 0.00MB
wp_st_order_item_meta: Data: 0.00MB + Index: 0.00MB
wp_st_price: Data: 0.00MB + Index: 0.00MB
wp_st_rental: Data: 0.00MB + Index: 0.00MB
wp_st_tours: Data: 0.00MB + Index: 0.00MB
wp_st_user_online: Data: 0.00MB + Index: 0.00MB
wp_termmeta: Data: 0.02MB + Index: 0.02MB
wp_terms: Data: 0.02MB + Index: 0.04MB
wp_term_relationships: Data: 0.04MB + Index: 0.08MB
wp_term_taxonomy: Data: 0.02MB + Index: 0.02MB
wp_trav_accommodation_bookings: Data: 0.00MB + Index: 0.00MB
wp_trav_accommodation_vacancies: Data: 0.00MB + Index: 0.00MB
wp_trav_currencies: Data: 0.00MB + Index: 0.00MB
wp_trav_reviews: Data: 0.00MB + Index: 0.00MB
wp_trav_tour_bookings: Data: 0.00MB + Index: 0.00MB
wp_trav_tour_schedule: Data: 0.00MB + Index: 0.00MB
wp_usermeta: Data: 0.07MB + Index: 0.05MB
wp_users: Data: 0.01MB + Index: 0.01MB
wp_wsluserscontacts: Data: 0.02MB + Index: 0.02MB
wp_wslusersprofiles: Data: 0.02MB + Index: 0.03MB
wp_yoast_seo_links: Data: 0.09MB + Index: 0.02MB
wp_yoast_seo_meta: Data: 0.11MB + Index: 0.00MB
wp_yuzoviews: Data: 0.00MB + Index: 0.00MB

Post Type Counts

attachment: 774
carts: 21
deprecated_log: 22
home_slider: 1
landing-page: 1
mapplic_map: 4
nav_menu_item: 104
nectar_slider: 9
oembed_cache: 7
option-tree: 1
page: 31
post: 160
product: 17
product_variation: 122
rm_connection: 1
rm_request: 1
shop_coupon: 1
shop_order: 13
shop_order_refund: 1
shop_webhook: 3
tabs_responsive: 1
wpcf7_contact_form: 2
wpematico: 1
wprss_feed: 1
wprss_feed_item: 5

Security

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

Active Plugins (47)

F1 Constructors Championship in full: by John McCurdy – 1.0.
F1 Drivers Championship in full: by John McCurdy – 1.0.
F1 Drivers Championship: by John McCurdy – 1.0.
Facebook Page Box: by John McCurdy – 1.0
F1 Next race: by John McCurdy – 1.0..
Custom Login for Discover Grand Prix: by John McCurdy – 1.0.
Mid Article Sign Up: by John McCurdy. – 1.0.
F1 Results - Last Race: by John McCurdy – 1.0.
Admin Menu Editor: by Janis Elsts – 1.8.1
Advanced Recent Posts: by Eugene Holin – 0.6.14
Cart countdown: by John McCurdy – 1.0
Contact Form 7 MailChimp Extension: by Renzo Johnson – 0.4.48
Contact Form 7: by Takayuki Miyoshi – 5.0
Duplicate Post: by Enrico Battocchi – 3.2.1
Eventbrite events list: by John McCurdy. – 1.0.
Google XML Sitemaps: by Arne Brachhold – 4.0.9
Insert Headers and Footers: by WPBeginner – 1.4.2
Salient Visual Composer: by Michael M - WPBakery.com | Modified by ThemeNectar – 5.2.4
MailChimp for WooCommerce: by MailChimp – 2.1.3 – Not tested with the active version of WooCommerce
Mashshare - Social Networks Add-On: by René Hermenau – 2.4.2
Mashshare Share Buttons: by René Hermenau – 3.4.8
PixelYourSite: by PixelYourSite – 5.1.0 – Not tested with the active version of WooCommerce
Printful Integration for WooCommerce: by Printful – 2.0.2
Progress Bar: by Chris Reynolds – 2.1.4
Publish to Apple News: by Alley Interactive – 1.3.0
Recent Posts Widget With Thumbnails: by Martin Stehle – 6.0
Redirection: by John Godley – 3.1.1
Regenerate Thumbnails: by Alex Mills (Viper007Bond) – 3.0.2
Send Images to RSS: by Robin Cornett – 3.2.2
SG Optimizer: by SiteGround – 3.3.5
SumoMe: by SumoMe – 1.27
Woo Checkout Field Editor Pro: by ThemeHiGH – 1.2.5
Woocommerce Variations Table - Grid: by Spyros Vlachopoulos – 1.3.4 – Not tested with the active version of WooCommerce
WooCommerce Extended Coupon Features: by Soft79 – 2.6.0.2
WooCommerce Cart Reports: by WPBackOffice – 1.1.8 – 1.1.20 is available – Not tested with the active version of WooCommerce
WooCommerce Print Invoice & Delivery Note: by Tyche Softwares – 4.4.1
WooCommerce DYMO Print: by bpluijms
wpfortune – 1.3.0 – Not tested with the active version of WooCommerce

WooCommerce Stripe Gateway: by WooCommerce – 4.0.4
WooCommerce Google Analytics Integration: by WooCommerce – 1.4.3 – Not tested with the active version of WooCommerce
WooCommerce: by Automattic – 3.2.6
Yoast SEO: by Team Yoast – 6.2
WP All Import Pro: by Soflyy – 4.5.0
Facebook Login: by Damian Logghe – 1.2.3
WP Rocket | Shared By Themes24x7.com: by WP Rocket – 2.8.7
WP Smush: by WPMU DEV – 2.7.6
WP User Avatar: by flippercode – 2.0.9
WP All Import - WooCommerce Add-On Pro: by Soflyy – 2.3.8

Settings

API Enabled: ✔
Force SSL: ✔
Currency: GBP (£)
Currency Position: left
Thousand Separator: ,
Decimal Separator: .
Number of Decimals: 0
Taxonomies: Product Types: bundle (bundle)
composite (composite)
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: ❌ Page visibility should be public
Basket: #164 - /cart/
Checkout: #165 - /checkout/
My account: #166 - /my-account/
Terms and conditions: #33 - /terms-conditions/

Theme

Name: Salient
Version: 8.0.15
Author URL: http://themenectar.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: salient 8.0.15/woocommerce/cart/cart-shipping.php version 2.5.0 is out of date. The core version is 3.2.0
salient 8.0.15/woocommerce/cart/cart-totals.php
salient 8.0.15/woocommerce/cart/cart.php version 3.0.3 is out of date. The core version is 3.1.0
salient 8.0.15/woocommerce/cart/shipping-calculator.php version 2.0.8 is out of date. The core version is 3.2.0
salient 8.0.15/woocommerce/checkout/form-billing.php
salient 8.0.15/woocommerce/checkout/form-checkout.php
salient 8.0.15/woocommerce/checkout/form-shipping.php version 3.0.0 is out of date. The core version is 3.0.9
salient 8.0.15/woocommerce/checkout/review-order.php
salient 8.0.15/woocommerce/checkout/terms.php version 2.5.0 is out of date. The core version is 3.1.1
salient 8.0.15/woocommerce/content-product.php
salient 8.0.15/woocommerce/content-single-product.php
salient 8.0.15/woocommerce/loop/add-to-cart.php
salient 8.0.15/woocommerce/loop/loop-start.php
salient 8.0.15/woocommerce/myaccount/form-login.php version 2.6.0 is out of date. The core version is 3.2.0
salient 8.0.15/woocommerce/single-product/price.php version 2.4.9 is out of date. The core version is 3.0.0
salient 8.0.15/woocommerce/single-product/product-image.php version 3.0.2 is out of date. The core version is 3.1.0
salient 8.0.15/woocommerce/single-product/tabs/description.php
salient 8.0.15/woocommerce/single-product/tabs/tabs.php

Outdated Templates: ❌Learn how to update

@mikejolley
Copy link
Member

I don't think this is something we can assist with.

  • IDs are unique - they cannot be assigned to 2 products
  • wp all import is not part of core.
  • your sync script could also be changing this.

If you want to provide a sample CSV for the core importer, I can test it, however, our sample data (https://github.com/woocommerce/woocommerce/blob/master/sample-data/sample_products.csv) is importing variable products fine, and unit tests run against it.

Therefore I struggle to see how this could possible relate to core, and is more likely an error in either the CSV or script running alongside WooCommerce.

Thanks

@johnlmccurdy
Copy link
Author

When I talk of IDs I specifically mean the term_taxonomy_id Please see a screen grab of what is supposed to be a variable product with the term_taxonomy_id of both 4 and 6.

https://www.dropbox.com/s/fj51keyj62t79yo/Screenshot%202018-02-01%2020.56.05.png?dl=0

When I look at the wp_terms table (which as I understand it is creating that relationship with the wp_terms_relationship table) the number 4 correlates to simple product and 6 correlates to a variable product. See second screen grab below

https://www.dropbox.com/s/nelfx75uehyzb1u/Screenshot%202018-02-01%2020.58.45.png?dl=0

I understand that wp all import is not part of core. But this is also happening with the import function.

Thanks for the super quick response Mike.

@mikejolley
Copy link
Member

We use wp_set_object_terms so in theory this could be intercepted by another plugin. If you share a CSV I can check if it works fine, or you can try on a different install.

@johnlmccurdy
Copy link
Author

I don't know how to upload one here, but nonetheless here is a drop box link to one of the products.

https://www.dropbox.com/s/por66ef6k26m57o/Formula%201%20Tickets%20-%20Mexico.csv?dl=0

I will look into wp_set_object_terms to see what i can uncover. Thanks.

@mikejolley
Copy link
Member

I'll check tomorrow thanks

@mikejolley
Copy link
Member

Variable products need variations. Create one manually and export if you're unsure of the format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants