Support » Plugin: WooCommerce » product categories duplicated after woocommerce update

  • Resolved darrenmaximo

    (@darrenmaximo)


    Hi,

    Im having this issue after woocommerce update.
    The product category are duplicated, each duplicated category has the same slug and ID of the original category, also when I try to delete the duplicate the original category also deleted.

    this is the url of the website.

    ### WordPress Environment ###
    
    Home URL: http://www.rockface.com.au
    Site URL: http://www.rockface.com.au
    WC Version: 2.6.1
    Log Directory Writable: ✔
    WP Version: 4.5.2
    WP Multisite: –
    WP Memory Limit: 256 MB
    WP Debug Mode: –
    WP Cron: ✔
    Language: en_US
    
    ### Server Environment ###
    
    Server Info: LiteSpeed
    PHP Version: ❌ 5.4.44 - We recommend a minimum PHP version of 5.6. See: How to update your PHP version
    PHP Post Max Size: 8 MB
    PHP Time Limit: 30
    PHP Max Input Vars: 1000
    cURL Version: 7.38.0
    OpenSSL/1.0.1e
    
    SUHOSIN Installed: –
    MySQL Version: 5.6.30
    Max Upload Size: 8 MB
    Default Timezone is UTC: ✔
    fsockopen/cURL: ✔
    SoapClient: ✔
    DOMDocument: ✔
    GZip: ✔
    Multibyte String: ✔
    Remote Post: ✔
    Remote Get: ✔
    
    ### Database ###
    
    WC Database Version: 2.6.1
    :
    woocommerce_sessions: ✔
    woocommerce_api_keys: ✔
    woocommerce_attribute_taxonomies: ✔
    woocommerce_downloadable_product_permissions: ✔
    woocommerce_order_items: ✔
    woocommerce_order_itemmeta: ✔
    woocommerce_tax_rates: ✔
    woocommerce_tax_rate_locations: ✔
    woocommerce_shipping_zones: ✔
    woocommerce_shipping_zone_locations: ✔
    woocommerce_shipping_zone_methods: ✔
    woocommerce_payment_tokens: ✔
    woocommerce_payment_tokenmeta: ✔
    MaxMind GeoIP Database: ✔
    
    ### Active Plugins (23) ###
    
    Redux Framework: by Team Redux – 3.6.0.2
    LayerSlider WP: by Kreatura Media – 5.6.8
    Advanced Custom Fields: by Elliot Condon – 4.4.7
    All In One SEO Pack Pro: by Michael Torbert – 2.4.5.1
    BackWPup: by Inpsyde GmbH – 3.3.2
    Contact Form 7 Honeypot: by Nocean – 1.9
    Contact Form 7: by Takayuki Miyoshi – 4.4.2
    Disable XML-RPC: by Philip Erb – 1.0.1
    Limit Login Attempts: by Johan Eenfeldt – 1.7.1
    Max Mega Menu: by Tom Hemsley – 2.1.5
    Really Simple CAPTCHA: by Takayuki Miyoshi – 1.9
    Rename wp-login.php: by Ella Iseulde Van Dorpe – 2.5.5
    Sucuri Security - Auditing, Malware Scanner and Hardening: by Sucuri
    INC – 1.7.17
    
    WooCommerce Customizer: by SkyVerge – 2.3.1
    Securepay for WooCommerce: by SolverCircle – 1.0.0
    WooCommerce: by WooThemes – 2.6.1
    WP-Ban: by Lester 'GaMerZ' Chan – 1.68
    WP Google Map Plugin: by flippercode – 3.1.1
    WP Lightbox 2: by Syed Balkhi – 3.0.6.2
    WP-SpamShield: by Scott Allen – 1.9.8.7
    YITH WooCommerce Compare: by Yithemes – 2.0.5
    YITH WooCommerce Quick View: by YITHEMES – 1.1.2
    YITH WooCommerce Wishlist: by YITHEMES – 2.0.16
    
    ### Settings ###
    
    Force SSL: ✔
    Currency: AUD ($)
    Currency Position: left
    Thousand Separator: ,
    Decimal Separator: .
    Number of Decimals: 2
    
    ### API ###
    
    API Enabled: ✔
    
    ### WC Pages ###
    
    Shop Base: #248 - /shop/
    Cart: #249 - /cart/
    Checkout: #250 - /checkout/
    My Account: #251 - /my-account/
    
    ### Taxonomies ###
    
    Product Types: external (external)
    grouped (grouped)
    simple (simple)
    variable (variable)
    
    ### Theme ###
    
    Name: Fabia Child Theme
    Version: 1.4
    Author URL: https://www.magikcommerce.com/
    Child Theme: ✔
    Parent Theme Name: Fabia
    Parent Theme Version: 1.4
    Parent Theme Author URL: https://www.magikcommerce.com/
    WooCommerce Support: ✔
    
    ### Templates ###
    
    Overrides: fabia/woocommerce/archive-product.php
    fabia/woocommerce/cart/cart-empty.php
    fabia/woocommerce/cart/cart-item-data.php
    fabia/woocommerce/cart/cart-shipping.php version 2.3.0 is out of date. The core version is 2.5.0
    fabia/woocommerce/cart/cart-totals.php
    fabia/woocommerce/cart/cart.php
    fabia/woocommerce/cart/cross-sells.php
    fabia/woocommerce/cart/mini-cart.php version 2.1.0 is out of date. The core version is 2.5.0
    fabia/woocommerce/checkout/cart-errors.php
    fabia/woocommerce/checkout/form-billing.php
    fabia/woocommerce/checkout/form-checkout.php
    fabia/woocommerce/checkout/form-coupon.php
    fabia/woocommerce/checkout/form-login.php
    fabia/woocommerce/checkout/form-pay.php version 2.4.7 is out of date. The core version is 2.5.0
    fabia/woocommerce/checkout/form-shipping.php
    fabia/woocommerce/checkout/payment-method.php
    fabia/woocommerce/checkout/payment.php version 2.4.7 is out of date. The core version is 2.5.0
    fabia/woocommerce/checkout/review-order.php
    fabia/woocommerce/checkout/thankyou.php
    fabia/woocommerce/content-product.php version 2.4.0 is out of date. The core version is 2.6.1
    fabia/woocommerce/content-product_cat.php version 2.5.2 is out of date. The core version is 2.6.1
    fabia/woocommerce/content-single-product.php
    fabia/woocommerce/content-widget-product.php version - is out of date. The core version is 2.5.0
    fabia-child/woocommerce/emails/admin-new-order.php
    fabia/woocommerce/global/breadcrumb.php
    fabia/woocommerce/global/form-login.php
    fabia/woocommerce/global/quantity-input.php version 2.1.0 is out of date. The core version is 2.5.0
    fabia/woocommerce/global/sidebar.php
    fabia/woocommerce/global/wrapper-end.php
    fabia/woocommerce/global/wrapper-start.php
    fabia/woocommerce/loop/add-to-cart.php version 2.1.0 is out of date. The core version is 2.5.0
    fabia/woocommerce/loop/loop-end.php version - is out of date. The core version is 2.0.0
    fabia/woocommerce/loop/loop-start.php version - is out of date. The core version is 2.0.0
    fabia/woocommerce/loop/no-products-found.php
    fabia/woocommerce/loop/orderby.php
    fabia/woocommerce/loop/pagination.php
    fabia/woocommerce/loop/price.php
    fabia/woocommerce/loop/rating.php
    fabia/woocommerce/loop/result-count.php
    fabia/woocommerce/loop/sale-flash.php
    fabia/woocommerce/myaccount/form-add-payment-method.php version 2.1 is out of date. The core version is 2.6.0
    fabia/woocommerce/myaccount/form-edit-account.php version 2.2.7 is out of date. The core version is 2.6.0
    fabia/woocommerce/myaccount/form-edit-address.php version 2.1.0 is out of date. The core version is 2.6.0
    fabia/woocommerce/myaccount/form-login.php version 2.2.6 is out of date. The core version is 2.6.0
    fabia/woocommerce/myaccount/form-lost-password.php version 2.3.0 is out of date. The core version is 2.6.0
    fabia/woocommerce/myaccount/my-account.php version 2.0.0 is out of date. The core version is 2.6.0
    fabia/woocommerce/myaccount/my-address.php version 2.2.0 is out of date. The core version is 2.6.0
    fabia/woocommerce/myaccount/my-downloads.php
    fabia/woocommerce/myaccount/my-orders.php
    fabia/woocommerce/myaccount/view-order.php version 2.2.0 is out of date. The core version is 2.6.0
    fabia/woocommerce/notices/error.php
    fabia/woocommerce/notices/notice.php
    fabia/woocommerce/notices/success.php
    fabia/woocommerce/product-searchform.php version - is out of date. The core version is 2.5.0
    fabia/woocommerce/single-product/add-to-cart/external.php
    fabia/woocommerce/single-product/add-to-cart/grouped.php
    fabia/woocommerce/single-product/add-to-cart/simple.php
    fabia/woocommerce/single-product/add-to-cart/variable.php version 2.4.0 is out of date. The core version is 2.5.0
    fabia/woocommerce/single-product/meta.php
    fabia/woocommerce/single-product/price.php version 1.6.4 is out of date. The core version is 2.4.9
    fabia/woocommerce/single-product/product-attributes.php
    fabia/woocommerce/single-product/product-image.php
    fabia/woocommerce/single-product/product-thumbnails.php
    fabia/woocommerce/single-product/rating.php
    fabia/woocommerce/single-product/related.php
    fabia/woocommerce/single-product/review.php version 2.1.0 is out of date. The core version is 2.6.0
    fabia/woocommerce/single-product/sale-flash.php
    fabia/woocommerce/single-product/share.php
    fabia/woocommerce/single-product/short-description.php
    fabia/woocommerce/single-product/tabs/additional-information.php
    fabia/woocommerce/single-product/tabs/description.php
    fabia/woocommerce/single-product/tabs/tabs.php
    fabia/woocommerce/single-product/title.php
    fabia/woocommerce/single-product/up-sells.php
    fabia/woocommerce/single-product-reviews.php
    fabia/woocommerce/single-product.php
    fabia/woocommerce/taxonomy-product_cat.php
    fabia/woocommerce/taxonomy-product_tag.php
    
    : Learn how to update outdated templates

    Thanks

    https://wordpress.org/plugins/woocommerce/

Viewing 14 replies - 16 through 29 (of 29 total)
  • zaptuba

    (@zaptuba)

    My client’s website has the same issue of duplicate product categories (same slug and id) after updating to the latest WooCommerce. Will try the proposed fix from the GitHub link.

    @binhoscc @jonathanappleseed @zaptuba – try going to you wc-term-functions.php at line 510 and replace it with this;

    $clauses[‘fields’] = ‘DISTINCT t.term_id,’ . $clauses[‘fields’];

    see if that solves your issue.

    @dlareg08 – thank you for your suggestion. I replaced Line 510 with the proposed code and the duplicate product categories are now gone from the Shop page and the list of Product Categories in the WordPress dashboard. Thank you @dlareg08 for that, hopefully someone will integrate this fix into the next version of WooCommerce.

    A small note: When copying and pasting the code above, I had to replace the formatted single quotes to plain single quotes in my text editor for the code to work

    • This reply was modified 5 months, 3 weeks ago by  zaptuba.

    @zaptuba – your welcome! im glad i was able to help you. I experienced this issue just last 3 weeks ago and i thought i need to rebuild my categories and assign my products again which will take me a lot of time. then i saw mike’s solution before and compared it with the updated wc-term-functions. It took me like two weeks to solve this issue trying to search for possible solution. I hope that those who have this same issue will see this solution.

    Right now, i dont need to edit my wc-term-functions as the updated version doesnt show duplicate product categories. You might see those duplicates again just edit and save or update to the latest version.

    Regards!

    zaptuba

    (@zaptuba)

    @mikejolley – I was wondering whether it would be possible to integrate the fix proposed by @dlareg08 into a WooCommerce release, as I’ve had to re-integrate the fix (3 times now) into my client’s WooCommerce install each time she updates to the latest WooCommerce release. Thank you for your time and assistance.

    Plugin Author Mike Jolley

    (@mikejolley)

    The fix looks like it may have issues with some SQL setups – I’m not sure it’s ideal.

    In testing, I couldn’t cause it to occur. Some users have QTranslate, but that has an option to switch to single terms with multiple translations which avoids the issue.

    zaptuba

    (@zaptuba)

    Thank you for your prompt response @mikejolley! I will look into the QTranslate option for my client.

    My client’s Shop only started showing doubles of some product categories after updating to WooCommerce 3.0. Up until that point it was fine. If there is any data, that I can send you that might help you debug this issue, let me know and I can provide this to you privately.

    Thanks again!

    Plugin Author Mike Jolley

    (@mikejolley)

    Would be best to first rule out conflicts with other plugins before looking at the data itself.

    druideniggi

    (@druideniggi)

    Also with update on woo 3.0.7 the categories are displayed twice. Plugins except woo I have turned off. Under different theme the same problem.
    With the change of the functions.php at line 510 and replace it with this;

    $ Clauses [‘fields’] = ‘DISTINCT t.term_id,’. $ Clauses [‘fields’];
    The shop base is shown without category. Only the products are displayed.
    Permalink Setting: Postname –
    optional:
    Category basic products: product category

    Keyword basis (tag) Products: product tag

    Product Permalinks: standard
    Also with other settings the same problem.
    Has no solution?
    It seems to be a bug.

    In response to @mikejolley‘s feedback, I decided to explore one other option. On my client’s website, not all of her product categories were duplicated after the WooCommerce 3.0 upgrade. Since the number of products and product categories were manageable, I wanted to see if re-creating the problematic product categories and re-assigning the products to the newly created product categories would fix the problem. I started with the smallest product category and did the following:

    • Created a new product category with the same name and a slug product-name-2
    • Re-assigned the 1 product in the original product category to the new product category. By doing this, it caused the original product category to be empty.
    • Checked the Shop page, and confirmed the new product category displayed properly as one single category.
    • Deleted one instance of the original product category (remember it appears twice in the list).
    • Updated the product slug of the new product category from product-name-2 to product-name to restore the category URL to the way it was
    • At that point I refreshed the list by selecting Products:Categories in the left side menu of the WordPress Dashboard. Confirmed that the new product category was still displayed as 1 category.

    SURPRISINGLY, at that point, I noticed that all of the OTHER duplicate product categories now only displayed ONCE. So it looks like the action of deleting just ONE of the problematic duplicate product categories, somehow “reset” ALL of the other categories and fixed the duplicates issue.

    I can not say definitively why this fixed my client’s shop, but hopefully it provides developers a data point, and a possible workaround to the problem.

    • This reply was modified 4 months, 4 weeks ago by  zaptuba.

    Thank you, a good approach, I will test it in my testshop. I’ll get back to you

    I also have a client who had a few duplicated categories, but none were duplicated in the database.

    Duplicated Categories

    Checking the database, there was only one category-slug in the terms table.

    Removal of the duplicate via admin caused deletion of “both” instances.

    Removing from line 510 of wc-term-functions.php

    . ', tm.meta_value'

    Did resolve the duplicate categories from both the Admin and the Frontend, but obviously this is not the ideal situation to edit the plugin in this fashion.

    (WooCommerce 3.0.7)

    • This reply was modified 4 months, 4 weeks ago by  thehowarde.

    I’m experiencing the exact same thing but with Attributes terms. I have this shop where one of the Attributes (Size) is showing duplicated terms, with the same ID and slug, backend and frontend. Other Attributes and taxonomies are OK.

    After update on woocommerce 3.0.8
    The following function is already integrated:

    Removing from line 510 of wc-term-functions.php

    . ', tm.meta_value'

    Problem still not resolved

Viewing 14 replies - 16 through 29 (of 29 total)
  • You must be logged in to reply to this topic.