Support » Plugin: WooCommerce » Use of deprecated $product->ID

  • Resolved gutding

    (@gutding)


    Hi there,

    my error.log gets cluttered up with notices that the use of $product->ID is deprecated. Should be $product->get_id() now.
    I found $product->ID in these files:

    ./wp-content/plugins/woocommerce/includes/class-wc-product-factory.php:		} elseif ( ! empty( $product->ID ) ) {
    ./wp-content/plugins/woocommerce/includes/class-wc-product-factory.php:			return $product->ID;
    ./wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-product.php:		} elseif ( ! empty( $product->ID ) ) {
    ./wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-product.php:			$this->set_id( absint( $product->ID ) );

    Any chance that you can fix that in an upcoming version?

    Here is the error notice (one of many):

    Jan 24, 10:11:02
    Notice: id wurde <strong>fehlerhaft aufgerufen</strong>. Produkteigenschaften sollten nicht direkt abgerufen werden. Backtrace: require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/plugins/woocommerce/templates/single-product.php'), wc_get_template_part, load_template, require('/plugins/woocommerce/templates/content-single-product.php'), do_action('woocommerce_after_single_product_summary'), WP_Hook->do_action, WP_Hook->apply_filters, woocommerce_output_product_data_tabs, wc_get_template, include('/plugins/woocommerce/templates/single-product/tabs/tabs.php'), apply_filters('woocommerce_product_tabs'), WP_Hook->apply_filters, Woocommerce_Product_Tabs_Public->custom_woocommerce_product_tabs, apply_filters('wpt_filter_product_tabs'), WP_Hook->apply_filters, Woocommerce_Product_Tabs_Public->tab_status_check, WC_Abstract_Legacy_Product->__get, wc_doing_it_wrong Weitere Informationen: <a href="https://codex.wordpress.org/Debugging_in_WordPress">Debugging in WordPress (engl.)</a> (Diese in /wp-includes/functions.php on line 4231
    Stack Trace
    
    1.	
    call_user_func(Array(2), 1024, 'id wurde <strong>fehle...', '/home/www/gutding/wp-i...', 4231, Array(3))
    /wp-content/plugins/flexible-shipping/vendor/monolog/monolog/src/Monolog/ErrorHandler.php:173
    2.	
    Monolog\ErrorHandler->handleError(1024, 'id wurde <strong>fehle...', '/home/www/gutding/wp-i...', 4231, Array(3))
    3.	
    trigger_error('id wurde <strong>fehle...')
    /wp-includes/functions.php:4231
    4.	
    _doing_it_wrong('id', 'Produkteigenschaften s...', '(Diese Meldung wurde i...')
    /wp-content/plugins/woocommerce/includes/wc-deprecated-functions.php:116
    5.	
    wc_doing_it_wrong('id', 'Produkteigenschaften s...', '3.0')
    /wp-content/plugins/woocommerce/includes/legacy/abstract-wc-legacy-product.php:72
    6.	
    WC_Abstract_Legacy_Product->__get('id')
    /wp-content/plugins/woocommerce-product-tabs/public/class-woocommerce-product-tabs-public.php:137
    7.	
    Woocommerce_Product_Tabs_Public->tab_status_check(Array(1))
    /wp-includes/class-wp-hook.php:286
    8.	
    WP_Hook->apply_filters(Array(5), Array(1))
    /wp-includes/plugin.php:203
    9.	
    apply_filters('wpt_filter_product_tabs', Array(5))
    /wp-content/plugins/woocommerce-product-tabs/public/class-woocommerce-product-tabs-public.php:89
    10.	
    Woocommerce_Product_Tabs_Public->custom_woocommerce_product_tabs(Array(1))
    /wp-includes/class-wp-hook.php:286
    11.	
    WP_Hook->apply_filters(Array(1), Array(1))
    /wp-includes/plugin.php:203
    12.	
    apply_filters('woocommerce_product_tabs', Array(0))
    /wp-content/plugins/woocommerce/templates/single-product/tabs/tabs.php:29
    13.	
    include('/home/www/gutding/wp-c...')
    /wp-content/plugins/woocommerce/includes/wc-core-functions.php:211
    14.	
    wc_get_template('single-product/tabs/ta...')
    /wp-content/plugins/woocommerce/includes/wc-template-functions.php:1418
    15.	
    woocommerce_output_product_data_tabs('')
    /wp-includes/class-wp-hook.php:286
    16.	
    WP_Hook->apply_filters('', Array(1))
    /wp-includes/class-wp-hook.php:310
    17.	
    WP_Hook->do_action(Array(1))
    /wp-includes/plugin.php:453
    18.	
    do_action('woocommerce_after_sing...')
    /wp-content/plugins/woocommerce/templates/content-single-product.php:70
    19.	
    require('/home/www/gutding/wp-c...')
    /wp-includes/template.php:690
    20.	
    load_template('/home/www/gutding/wp-c...', false)
    /wp-content/plugins/woocommerce/includes/wc-core-functions.php:181
    21.	
    wc_get_template_part('content', 'single-product')
    /wp-content/plugins/woocommerce/templates/single-product.php:37
    22.	
    include('/home/www/gutding/wp-c...')
    /wp-includes/template-loader.php:74
    23.	
    require_once('/home/www/gutding/wp-i...')
    /wp-blog-header.php:19
    24.	
    require('/home/www/gutding/wp-b...')
    /index.php:17
    Context
    
    URL	/produkt/kissen/
    HTTP Method	GET
    HTTP Host	gutding.org
    HTTP Status	200
    isSSL	Yes
    Current Filter	woocommerce_after_single_product_summary, woocommerce_product_tabs, wpt_filter_product_tabs
    Execution Time	1.556 s
    Memory Usage	50.19 MiB
    PHP SAPI	apache2handler

    Here is my Woo Status:

    
    ### WordPress Environment ###
    
    Home URL: https://gutding.org
    Site URL: https://gutding.org
    WC Version: 3.5.4
    Log Directory Writable: ✔
    WP Version: 5.0.3
    WP Multisite: –
    WP Memory Limit: 256 MB
    WP Debug Mode: ✔
    WP Cron: ✔
    Language: de_DE
    External object cache: –
    
    ### Server Environment ###
    
    Server Info: Apache
    PHP Version: 7.2.14-1+0~20190113100742.14+stretch~1.gbpd83c69
    PHP Post Max Size: 150 MB
    PHP Time Limit: 30
    PHP Max Input Vars: 1000
    cURL Version: 7.52.1
    OpenSSL/1.0.2q
    
    SUHOSIN Installed: –
    MySQL Version: 5.7.21-log
    Max Upload Size: 150 MB
    Default Timezone is UTC: ✔
    fsockopen/cURL: ✔
    SoapClient: ✔
    DOMDocument: ✔
    GZip: ✔
    Multibyte String: ✔
    Remote Post: ✔
    Remote Get: ✔
    
    ### Database ###
    
    WC Database Version: 3.5.4
    WC Database Prefix: wp_
    Datenbank-Gesamtgröße: 47.37MB
    Datenbank-Datengröße: 44.51MB
    Datenbank-Indexgröße: 2.86MB
    wp_woocommerce_sessions: Daten: 2.47MB + Index: 0.05MB
    wp_woocommerce_api_keys: Daten: 0.00MB + Index: 0.00MB
    wp_woocommerce_attribute_taxonomies: Daten: 0.00MB + Index: 0.00MB
    wp_woocommerce_downloadable_product_permissions: Daten: 0.00MB + Index: 0.00MB
    wp_woocommerce_order_items: Daten: 0.04MB + Index: 0.02MB
    wp_woocommerce_order_itemmeta: Daten: 0.49MB + Index: 0.24MB
    wp_woocommerce_tax_rates: Daten: 0.01MB + Index: 0.01MB
    wp_woocommerce_tax_rate_locations: Daten: 0.00MB + Index: 0.00MB
    wp_woocommerce_shipping_zones: Daten: 0.00MB + Index: 0.00MB
    wp_woocommerce_shipping_zone_locations: Daten: 0.00MB + Index: 0.00MB
    wp_woocommerce_shipping_zone_methods: Daten: 0.00MB + Index: 0.00MB
    wp_woocommerce_payment_tokens: Daten: 0.00MB + Index: 0.00MB
    wp_woocommerce_payment_tokenmeta: Daten: 0.00MB + Index: 0.00MB
    wp_woocommerce_log: Daten: 0.00MB + Index: 0.00MB
    wp_bounced_email_logs: Daten: 0.02MB + Index: 0.00MB
    wp_chanimator: Daten: 0.01MB + Index: 0.00MB
    wp_commentmeta: Daten: 0.01MB + Index: 0.01MB
    wp_comments: Daten: 0.08MB + Index: 0.03MB
    wp_csshero3: Daten: 0.15MB + Index: 0.00MB
    wp_elm_daily_stats: Daten: 0.02MB + Index: 0.00MB
    wp_elm_hourly_stats: Daten: 0.02MB + Index: 0.00MB
    wp_elm_summary: Daten: 0.14MB + Index: 0.05MB
    wp_elm_summary_progress: Daten: 0.02MB + Index: 0.02MB
    wp_gdpr_data_register: Daten: 0.00MB + Index: 0.00MB
    wp_gdpr_del_requests: Daten: 0.00MB + Index: 0.00MB
    wp_gdpr_log: Daten: 0.01MB + Index: 0.00MB
    wp_gdpr_requests: Daten: 0.00MB + Index: 0.00MB
    wp_itsec_distributed_storage: Daten: 0.00MB + Index: 0.00MB
    wp_itsec_fingerprints: Daten: 0.02MB + Index: 0.03MB
    wp_itsec_geolocation_cache: Daten: 0.02MB + Index: 0.03MB
    wp_itsec_lockouts: Daten: 0.04MB + Index: 0.04MB
    wp_itsec_log: Daten: 0.05MB + Index: 0.01MB
    wp_itsec_logs: Daten: 27.52MB + Index: 0.53MB
    wp_itsec_temp: Daten: 0.08MB + Index: 0.07MB
    wp_links: Daten: 0.00MB + Index: 0.00MB
    wp_mailpoet_custom_fields: Daten: 0.00MB + Index: 0.00MB
    wp_mailpoet_forms: Daten: 0.00MB + Index: 0.00MB
    wp_mailpoet_log: Daten: 0.02MB + Index: 0.00MB
    wp_mailpoet_mapping_to_external_entities: Daten: 0.00MB + Index: 0.00MB
    wp_mailpoet_newsletters: Daten: 0.32MB + Index: 0.00MB
    wp_mailpoet_newsletter_links: Daten: 0.18MB + Index: 0.08MB
    wp_mailpoet_newsletter_option: Daten: 0.00MB + Index: 0.00MB
    wp_mailpoet_newsletter_option_fields: Daten: 0.00MB + Index: 0.01MB
    wp_mailpoet_newsletter_posts: Daten: 0.00MB + Index: 0.00MB
    wp_mailpoet_newsletter_segment: Daten: 0.00MB + Index: 0.00MB
    wp_mailpoet_newsletter_templates: Daten: 4.22MB + Index: 0.00MB
    wp_mailpoet_scheduled_tasks: Daten: 0.01MB + Index: 0.01MB
    wp_mailpoet_scheduled_task_subscribers: Daten: 0.05MB + Index: 0.06MB
    wp_mailpoet_segments: Daten: 0.00MB + Index: 0.00MB
    wp_mailpoet_sending_queues: Daten: 0.51MB + Index: 0.00MB
    wp_mailpoet_settings: Daten: 0.00MB + Index: 0.00MB
    wp_mailpoet_statistics_clicks: Daten: 0.00MB + Index: 0.01MB
    wp_mailpoet_statistics_forms: Daten: 0.00MB + Index: 0.00MB
    wp_mailpoet_statistics_newsletters: Daten: 0.01MB + Index: 0.03MB
    wp_mailpoet_statistics_opens: Daten: 0.01MB + Index: 0.02MB
    wp_mailpoet_statistics_unsubscribes: Daten: 0.00MB + Index: 0.00MB
    wp_mailpoet_subscribers: Daten: 0.01MB + Index: 0.02MB
    wp_mailpoet_subscriber_custom_field: Daten: 0.00MB + Index: 0.00MB
    wp_mailpoet_subscriber_ips: Daten: 0.00MB + Index: 0.00MB
    wp_mailpoet_subscriber_segment: Daten: 0.01MB + Index: 0.01MB
    wp_newsletter: Daten: 0.00MB + Index: 0.01MB
    wp_newsletter_emails: Daten: 0.02MB + Index: 0.00MB
    wp_newsletter_sent: Daten: 0.00MB + Index: 0.00MB
    wp_newsletter_stats: Daten: 0.00MB + Index: 0.00MB
    wp_options: Daten: 2.38MB + Index: 0.15MB
    wp_postmeta: Daten: 2.50MB + Index: 0.82MB
    wp_posts: Daten: 2.75MB + Index: 0.25MB
    wp_query_override_terms: Daten: 0.00MB + Index: 0.00MB
    wp_query_wrangler: Daten: 0.00MB + Index: 0.00MB
    wp_termmeta: Daten: 0.00MB + Index: 0.01MB
    wp_terms: Daten: 0.00MB + Index: 0.01MB
    wp_term_relationships: Daten: 0.02MB + Index: 0.05MB
    wp_term_taxonomy: Daten: 0.02MB + Index: 0.01MB
    wp_toolset_post_guid_id: Daten: 0.01MB + Index: 0.01MB
    wp_usermeta: Daten: 0.18MB + Index: 0.10MB
    wp_users: Daten: 0.01MB + Index: 0.01MB
    wp_wcpdf_invoice_number: Daten: 0.00MB + Index: 0.00MB
    wp_wc_download_log: Daten: 0.00MB + Index: 0.00MB
    wp_wc_webhooks: Daten: 0.00MB + Index: 0.00MB
    wp_wpgdprc_access_requests: Daten: 0.00MB + Index: 0.00MB
    wp_wpgdprc_consents: Daten: 0.00MB + Index: 0.00MB
    wp_wpgdprc_delete_requests: Daten: 0.00MB + Index: 0.00MB
    wp_wpgdprc_log: Daten: 0.02MB + Index: 0.00MB
    wp_yoast_seo_links: Daten: 0.01MB + Index: 0.01MB
    wp_yoast_seo_meta: Daten: 0.02MB + Index: 0.03MB
    
    ### Post Type Counts ###
    
    attachment: 653
    custom_css: 1
    da_image: 1
    generate_page_header: 1
    invoice: 202
    is_search_form: 1
    jetpack_migration: 2
    jp_img_sitemap: 2
    jp_sitemap: 2
    jp_sitemap_master: 2
    jp_vid_sitemap: 2
    mailpoet_page: 1
    maplist: 577
    nav_menu_item: 42
    page: 38
    popup: 1
    popup_theme: 7
    post: 68
    product: 99
    product_variation: 28
    revision: 717
    shop_coupon: 1
    shop_order: 86
    shop_order_refund: 5
    woo_product_tab: 5
    wpcf7_contact_form: 4
    wphtmlmail_mail: 11
    yith-wccos-ostatus: 2
    
    ### Security ###
    
    Secure connection (HTTPS): ✔
    Hide errors from visitors: ✔
    
    ### Active Plugins (63) ###
    
    BackupBuddy: von iThemes – 8.3.4.0
    Featured Images in RSS for Mailchimp & Other Email: von 5 Star Plugins – 1.5.1
    Map List Pro: von SmartRedFox – 3.12.11
    Ivory Search: von Ivory Search – 4.1.5
    Akismet Anti-Spam: von Automattic – 4.1
    Autoptimize: von Frank Goossens (futtta) – 2.4.4
    iThemes Security: von iThemes – 7.2.0
    Block Bad Queries (BBQ): von Jeff Starr – 20181117
    Bounce Handler Mailpoet: von Tikweb – 1.3.12
    Child Theme Configurator: von Lilaea Media – 2.4.1
    Classic Editor: von WordPress-Mitwirkende – 1.3
    Contact Form 7: von Takayuki Miyoshi – 5.1.1
    Cookie Notice: von dFactory – 1.2.45
    CSS Hero: von The CSS Hero Team – 3.42
    Customizer Export/Import: von The Beaver Builder Team – 0.9
    Error Log Monitor Pro: von Janis Elsts – 1.6.4
    Flexible Shipping: von WP Desk – 3.1.2
    GP Premium: von Tom Usborne – 1.7.7
    Health Check & Troubleshooting: von Die WordPress.org-Community – 1.2.5
    HTTP Headers: von Dimitar Ivanov – 1.12.1
    Easy HTTPS (SSL) Redirection: von Tips and Tricks HQ – 1.9
    iThemes Sync: von iThemes – 2.0.13
    Jetpack von WordPress.com: von Automattic – 6.9
    Maintenance Mode: von Lukas Juhas – 2.4.3
    Loco Translate: von Tim Whitlock – 2.2.0
    MailPoet 3 (New): von MailPoet – 3.18.1
    Popup Maker: von WP Popup Maker – 1.7.30
    Query Wrangler: von Jonathan Daggerhart – 1.5.43
    Read More Without Refresh: von George Gkouvousis – 3.1
    Redirect URL to Post: von Chatty Mango – 0.9.0
    Simple Tags: von Amaury BALMER – 2.4.7
    Toolset Types: von OnTheGoSystems – 2.3.5
    Vendidero Helper: von Vendidero – 1.2.1
    WC Password Strength Settings: von Daniel Santoro – 2.0.2 – Nicht getestest mit der aktiven WooCommerce-Version
    Product Customer List for WooCommerce: von Kokomo – 2.7.9
    WooCommerce Product Subtitle: von Varun Sridharan – 3.1
    Widget Options: von Phpbits Creative Studio – 3.7.2
    Woo Checkout Field Editor Pro: von ThemeHiGH – 1.3.0
    WooCommerce Blocks: von Automattic – 1.3.1
    PayPal Plus für WooCommerce: von Inpsyde GmbH – 1.0.8 – Nicht getestest mit der aktiven WooCommerce-Version
    WPC Product Bundles for WooCommerce (Premium): von WPclever.net – 3.4.0
    WooCommerce Shipment Tracking Basic: von XAdapter – 1.0.8 – Nicht getestest mit der aktiven WooCommerce-Version
    WooCommerce PayPal Checkout Gateway: von WooCommerce – 1.6.6
    WooCommerce Stripe-Gateway: von WooCommerce – 4.1.14
    WooCommerce Germanized Pro: von Vendidero – 1.9.9
    WooCommerce Germanized: von Vendidero – 2.2.7
    WooCommerce Menu Cart: von Jeremiah Prummer
    Ewout Fernhout – 2.7.3
    
    WooCommerce Product Tabs: von Nilambar Sharma – 2.0.1 – Nicht getestest mit der aktiven WooCommerce-Version
    WooCommerce Services: von Automattic – 1.18.0
    WooCommerce Unit Of Measure: von Bradley Davis – 3.0.0
    WooCommerce: von Automattic – 3.5.4
    WordPress Importer: von wordpressdotorg – 0.6.4
    Yoast SEO: von Team Yoast – 9.5
    WP Crontrol: von John Blackbourn und Mitwirkende – 1.6.2
    WP Downgrade | Versionsvorgabe: von Reisetiger – 1.2.0
    WP GDPR Compliance: von Van Ons – 1.4.8
    WP HTML Mail: von Hannes Etzelstorfer – 2.8.4.2
    WP-Optimize: von David Anderson
    Ruhani Rabin
    Team Updraft – 2.2.11
    
    WP Rollback: von Impress.org – 1.6
    WP Super Cache: von Automattic – 1.6.4
    Translator Revolution DropDown: von SurStudio – 2.0.6
    WP User Avatar: von flippercode – 2.1.6
    WP HTML Mail - WooCommerce: von Hannes Etzelstorfer – 2.8.3
    
    ### Settings ###
    
    API Enabled: ✔
    Force SSL: ✔
    Currency: EUR (€)
    Currency Position: right_space
    Thousand Separator: .
    Decimal Separator: ,
    Number of Decimals: 2
    Taxonomies: Product Types: external (external)
    grouped (grouped)
    simple (simple)
    variable (variable)
    woosb (woosb)
    
    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-Basis: #197 - /shop/
    Warenkorb: #199 - /warenkorb/
    Kasse: #201 - /kasse/
    Mein Konto: #203 - /mein-konto/
    Allgemeine Geschäftsbedingungen: #212 - /agb/
    
    ### Theme ###
    
    Name: GeneratePress Child
    Version: 2.0.1.1516038515
    Author URL: https://tomusborne.com
    Child Theme: ✔
    Parent Theme Name: GeneratePress
    Parent Theme Version: 2.2.1
    Parent Theme Author URL: https://tomusborne.com
    WooCommerce Support: ✔
    
    ### Templates ###
    
    Overrides: /home/www/gutding/wp-content/plugins/wp-html-mail-woocommerce/views/woocommerce/template/admin-cancelled-order.php
    /home/www/gutding/wp-content/plugins/wp-html-mail-woocommerce/views/woocommerce/template/admin-failed-order.php
    /home/www/gutding/wp-content/plugins/wp-html-mail-woocommerce/views/woocommerce/template/admin-new-order.php
    /home/www/gutding/wp-content/plugins/wp-html-mail-woocommerce/views/woocommerce/template/customer-completed-order.php
    /home/www/gutding/wp-content/plugins/wp-html-mail-woocommerce/views/woocommerce/template/customer-invoice.php
    /home/www/gutding/wp-content/plugins/wp-html-mail-woocommerce/views/woocommerce/template/customer-new-account.php Version 3.5.0 ist veraltet. Die Hauptversion ist 3.5.2
    /home/www/gutding/wp-content/plugins/wp-html-mail-woocommerce/views/woocommerce/template/customer-note.php
    /home/www/gutding/wp-content/plugins/wp-html-mail-woocommerce/views/woocommerce/template/customer-on-hold-order.php
    /home/www/gutding/wp-content/plugins/wp-html-mail-woocommerce/views/woocommerce/template/customer-processing-order.php Version 3.5.0 ist veraltet. Die Hauptversion ist 3.5.4
    /home/www/gutding/wp-content/plugins/wp-html-mail-woocommerce/views/woocommerce/template/customer-refunded-order.php
    /home/www/gutding/wp-content/plugins/wp-html-mail-woocommerce/views/woocommerce/template/customer-reset-password.php
    /home/www/gutding/wp-content/plugins/wp-html-mail-woocommerce/views/woocommerce/template/email-addresses.php Version 3.2.1 ist veraltet. Die Hauptversion ist 3.5.4
    /home/www/gutding/wp-content/plugins/wp-html-mail-woocommerce/views/woocommerce/template/email-customer-details.php
    generatepress-child/woocommerce/emails/email-header.php
    /home/www/gutding/wp-content/plugins/wp-html-mail-woocommerce/views/woocommerce/template/email-order-details.php
    /home/www/gutding/wp-content/plugins/wp-html-mail-woocommerce/views/woocommerce/template/email-order-items.php
    generatepress-child/woocommerce/myaccount/form-login.php Version 3.4.0 ist veraltet. Die Hauptversion ist 3.5.0
    
    Outdated Templates: ❌
    					
    					
    						Erfahre
    wie du aktualisieren kannst
    
    

    Thank you!

    Best regards, Rado

Viewing 2 replies - 1 through 2 (of 2 total)
  • What you see in the Woocommerce core files is a support for this deprecated method (thats why it only gets a notice, not error). However they are being triggered by something which actually uses that, and judging by logs, it is probably something that adds code to your product tabs. Your theme, a plugin, or some custom function.

    Thanks,

    I will investigate this.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Use of deprecated $product->ID’ is closed to new replies.