• Resolved geonolis

    (@geonolis)


    I see a difference in the number of arguments of woocommerce_update_product hook, at class-wc-product-data-store-cpt.php in the file found in my installation in comparison to the official documentation:

    According to https://woocommerce.github.io/code-reference/files/woocommerce-includes-data-stores-class-wc-product-data-store-cpt.html#source-view.282 the hook works with 3 arguments (max): do_action( ‘woocommerce_update_product’, $product->get_id(), $product, $changes );

    In my installation of Woocommerce, the hook works with 2 args (max): do_action( ‘woocommerce_update_product’, $product->get_id(), $product); as in WC_Product_Data_Store_CPT class file (class-wc-product-data-store-cpt.php in woocommerce/includes/data-stores folder. The $changes arg is not found! Of course can edit the core file, but why is there such a difference?

    Am I missing something or it is a bug?

    Thank you.

    Here is my System Status Report:

    ### WordPress Environment ###
    
    WordPress address (URL): [Redacted]
    Site address (URL): [Redacted]
    WC Version: 9.2.3
    Legacy REST API Package Version: Το πρ?σθετο Legacy REST API δεν ε?ναι εγκατεστημ?νο σε αυτ?ν τον ιστ?τοπο.
    Action Scheduler Version: ? 3.8.1
    Log Directory Writable: ?
    WP Version: 6.6.1
    WP Multisite: –
    WP Memory Limit: 786 MB
    WP Debug Mode: –
    WP Cron: –
    Language: el
    External object cache: –
    
    ### Server Environment ###
    
    Server Info: nginx/1.24.0
    PHP Version: 8.3.11
    PHP Post Max Size: 128 MB
    PHP Time Limit: 300
    PHP Max Input Vars: 5120
    cURL Version: 7.29.0
    NSS/3.90
    
    SUHOSIN Installed: –
    MySQL Version: 10.6.18-MariaDB-cll-lve
    Max Upload Size: 128 MB
    Default Timezone is UTC: ?
    fsockopen/cURL: ?
    SoapClient: ?
    DOMDocument: ?
    GZip: ?
    Multibyte String: ?
    Remote Post: ?
    Remote Get: ?
    
    ### Database ###
    
    [REDACTED]
    
    ### Post Type Counts ###
    
    adt_product_feed: 10
    attachment: 21178
    br_labels: 5
    cms_block: 54
    custom_css: 2
    jetpack_migration: 2
    jp_img_sitemap: 3
    jp_img_sitemap_index: 1
    jp_sitemap: 1
    jp_sitemap_master: 1
    mc4wp-form: 3
    nav_menu_item: 167
    o-discount: 4
    o-list: 5
    oembed_cache: 873
    op-set: 1
    page: 74
    portfolio: 9
    post: 24
    product: 10925
    product_variation: 2486
    revision: 276
    saswp: 2
    shop_coupon: 55
    shop_order: 7781
    shop_order_refund: 216
    vtprd-rule: 1
    wcp_ruleset: 1
    wc_whsm: 1
    wd_woo_discounts: 4
    woodmart_layout: 1
    woodmart_sidebar: 1
    woodmart_slide: 28
    woodmart_woo_fbt: 1
    woodmart_woo_lv: 4
    wpcf7_contact_form: 4
    wp_global_styles: 1
    wp_navigation: 1
    yith-wcbm-badge: 2
    
    ### Security ###
    
    Secure connection (HTTPS): ?
    Hide errors from visitors: ?
    
    ### Active Plugins (45) ###
    
    Alpha Bank gateway - WooCommerce Gateway: απ? τον/την Antreas Gribas – 1.0
    Zorem Local Pickup: απ? τον/την zorem – 1.6.6
    AutoConvert Greeklish Permalinks: απ? τον/την Δημ?τρη? Μαυρουδ?? – 4.2.0
    Contact Form 7: απ? τον/την Takayuki Miyoshi – 5.9.8
    Geniki Taxydromiki Woo Vouchers v.3: απ? τον/την Γε?ργιο? Παπαμαν?λη? – 1.0.0
    GTM4WP - A Google Tag Manager (GTM) plugin for WordPress: απ? τον/την Thomas Geiger – 1.20.2
    Facebook for WooCommerce: απ? τον/την Facebook – 3.2.8
    Hide Shipping Method For WooCommerce: απ? τον/την theDotstore – 1.5.0
    WPBakery Page Builder: απ? τον/την Michael M - WPBakery.com – 7.9
    Klarna Order Management for WooCommerce: απ? τον/την klarna
    krokedil – 1.9.2
    
    Klarna Payments for WooCommerce: απ? τον/την klarna – 3.6.1
    Loco Translate: απ? τον/την Tim Whitlock – 2.6.11
    Mailgun: απ? τον/την Mailgun – 2.1.0
    Migrate Store: Export and Import WooCommerce Settings: απ? τον/την Nagdy – 1.1.3
    mirakl-connect: απ? τον/την GeoNolis – 1.0.0
    Mobile Assistant Connector: απ? τον/την eMagicOne – 2.2.4
    Omnisend for WooCommerce: απ? τον/την Omnisend – 1.15.18
    Pinterest for WooCommerce: απ? τον/την WooCommerce – 1.4.8
    PW WooCommerce Gift Cards: απ? τον/την Pimwick
    LLC – 2.3
    
    Regenerate Thumbnails: απ? τον/την Alex Mills (Viper007Bond) – 3.1.6
    Relevanssi: απ? τον/την Mikko Saari – 4.23.0
    Safe SVG: απ? τον/την 10up – 2.2.6
    Skroutz Analytics for WooCommerce: απ? τον/την Skroutz – 1.7.3
    WooCommerce Smart COD: απ? τον/την woosmartcod.com – 1.7.2
    WooCommerce Tree Table Rate Shipping: απ? τον/την tablerateshipping.com – 1.34.0
    WPC Product Bundles for WooCommerce: απ? τον/την WPClever – 8.1.0
    Product Feed PRO for WooCommerce: απ? τον/την AdTribes.io – 13.3.6
    WooCommerce Extended Coupon Features FREE: απ? τον/την Soft79 – 3.3.3
    WooCommerce PayPal Payments: απ? τον/την WooCommerce – 2.9.0
    WooCommerce: απ? τον/την Automattic – 9.2.3
    Woodmart Core: απ? τον/την  – 1.0.44
    BulkGate SMS Plugin for WooCommerce: απ? τον/την BulkGate – 3.0.6
    Yoast SEO Premium: απ? τον/την Ομ?δα Yoast – 23.4
    Yoast SEO: απ? τον/την Ομ?δα Yoast – 23.4
    WP All Export Pro: απ? τον/την Soflyy – 1.9.1
    WP All Import Pro: απ? τον/την Soflyy – 4.9.0
    WP Crontrol: απ? τον/την John Blackbourn – 1.17.0
    Ζωνταν? Συνομιλ?α 3CX: απ? τον/την 3CX – 10.0.14
    Opening Hours: απ? τον/την Jannik Portz – 2.3.0
    WP Rocket: απ? τον/την WP Media – 3.16.4
    Smart Image Resize PRO: απ? τον/την Nabil Lemsieh – 1.8.5
    WP All Export - WooCommerce Export Add-On Pro: απ? τον/την Soflyy – 1.0.9
    WP All Import - WooCommerce Import Add-On Pro: απ? τον/την Soflyy – 4.0.0
    Yoast SEO: WooCommerce: απ? τον/την Η ομ?δα του Yoast – 16.2
    WP All Import - Yoast WordPress SEO Add-On: απ? τον/την Soflyy – 1.1.8
    
    ### Inactive Plugins (10) ###
    
    Advanced Order Export For WooCommerce (Pro): απ? τον/την AlgolPlus – 3.2.1
    BestPrice 360o: απ? τον/την BestPrice – 1.1.3
    Bulk remove posts from category: απ? τον/την MasterNs – 3.3
    Create Geniki Taxydromiki Vouchers for Woocommerce Orders: απ? τον/την G.I . Papamanolis based on v1.0.0 of emspace.gr – 2.0.0
    Duplicate Menu: απ? τον/την Jonathan Christopher – 0.2.2
    Image Regenerate & Select Crop: απ? τον/την Iulia Cazan – 8.0.3
    Product Feed ELITE for WooCommerce: απ? τον/την AdTribes.io – 1.0.4
    WooCommerce Admin: απ? τον/την WooCommerce – 3.3.2
    WooCommerce Blocks: απ? τον/την Automattic – 11.7.0
    WooCommerce Cash On Pickup: απ? τον/την Marian Kadanka – 1.7.0
    
    ### Dropin Plugins () ###
    
    advanced-cache.php: advanced-cache.php
    maintenance.php: maintenance.php
    
    ### Settings ###
    
    Legacy API Enabled: –
    Force SSL: –
    Currency: EUR (€)
    Currency Position: left_space
    Thousand Separator: .
    Decimal Separator: ,
    Number of Decimals: 2
    Taxonomies: Product Types: external (external)
    grouped (grouped)
    pw gift card (pw-gift-card)
    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)
    
    Connected to WooCommerce.com: ?
    Enforce Approved Product Download Directories: –
    HPOS feature enabled: ?
    Order datastore: Automattic\WooCommerce\Internal\DataStores\Orders\OrdersTableDataStore
    HPOS data sync enabled: ?
    
    ### Logging ###
    
    Enabled: ?
    Handler: Automattic\WooCommerce\Internal\Admin\Logging\LogHandlerFileV2
    Retention period: 30 ημ?ρε?
    Level threshold: –
    Log directory size: 63 MB
    
    ### WC Pages ###
    
    Β?ση καταστ?ματο?: #2041 - /shop/
    Καλ?θι: #6 - /cart/ -  Contains the [woocommerce_cart] shortcode
    Ταμε?ο: #7 - /checkout/ -  Contains the [woocommerce_checkout] shortcode
    Ο λογαριασμ?? μου: #8 - /my-account/
    ?ροι και Προ?ποθ?σει?: #11 - /oroi-proypotheseis/
    
    ### Theme ###
    
    Name: Woodmart Child
    Version: 1.0.0
    Author URL: https://xtemos.com
    Child Theme: ?
    Parent Theme Name: Woodmart
    Parent Theme Version: 7.6.0
    Parent Theme Author URL: https://themeforest.net/user/xtemos
    WooCommerce Support: ?
    
    ### Templates ###
    
    Overrides: woodmart/woocommerce/archive-product.php
    woodmart/woocommerce/cart/cart-item-data.php
    woodmart/woocommerce/cart/cart.php
    woodmart/woocommerce/cart/cross-sells.php
    woodmart/woocommerce/cart/mini-cart.php
    woodmart/woocommerce/checkout/form-checkout.php
    woodmart/woocommerce/checkout/thankyou.php
    woodmart/woocommerce/content-product-cat.php
    woodmart/woocommerce/content-product.php
    woodmart/woocommerce/content-single-product.php
    woodmart/woocommerce/content-widget-product.php
    woodmart/woocommerce/global/breadcrumb.php
    woodmart/woocommerce/global/form-login.php ?κδοση 7.1.0 ε?ναι ληγμ?νο. Η βασικ? ?κδοση ε?ναι η 9.2.0
    woodmart/woocommerce/global/quantity-input.php
    woodmart/woocommerce/loop/add-to-cart.php
    woodmart/woocommerce/loop/loop-end.php
    woodmart/woocommerce/loop/loop-start.php
    woodmart/woocommerce/loop/no-products-found.php
    woodmart/woocommerce/loop/orderby.php
    woodmart/woocommerce/loop/pagination.php
    woodmart/woocommerce/loop/sale-flash.php
    woodmart/woocommerce/myaccount/form-login.php ?κδοση 7.0.1 ε?ναι ληγμ?νο. Η βασικ? ?κδοση ε?ναι η 9.2.0
    woodmart/woocommerce/product-searchform.php
    woodmart/woocommerce/single-product/add-to-cart/grouped.php
    woodmart/woocommerce/single-product/add-to-cart/variable.php
    woodmart/woocommerce/single-product/meta.php
    woodmart/woocommerce/single-product/product-attributes.php
    woodmart/woocommerce/single-product/product-image.php
    woodmart/woocommerce/single-product/product-thumbnails.php
    woodmart/woocommerce/single-product/rating.php
    woodmart/woocommerce/single-product/related.php
    woodmart/woocommerce/single-product/sale-flash.php
    woodmart/woocommerce/single-product/tabs/description.php
    woodmart/woocommerce/single-product/tabs/tabs.php
    woodmart/woocommerce/single-product/title.php
    woodmart/woocommerce/single-product/up-sells.php
    woodmart/woocommerce/single-product-reviews.php
    woodmart/woocommerce/single-product.php
    
    Outdated Templates: ?
    
    
                            Μ?θετε πω? να κ?νετε ενημ?ρωση
    
    ### Klarna Payments Request Log ###
    
    No Klarna Payment errors: 
    
    ### Klarna Countries ###
    
    Production Countries: GR
    Test Countries: No countries selected
    
    ### WooCommerce PayPal Payments ###
    
    Onboarded: ?
    Shop country code: GR
    WooCommerce currency supported: ?
    Advanced Card Processing available in country: ?
    Pay Later messaging available in country: –
    Webhook status: –
    PayPal Vault enabled: ?
    ACDC Vault enabled: –
    Logging enabled: –
    Reference Transactions: ?
    Used PayPal Checkout plugin: ?
    Subscriptions Mode: Disabled
    
    ### Admin ###
    
    Enabled Features: activity-panels
    analytics
    product-block-editor
    coupons
    core-profiler
    customize-store
    customer-effort-score-tracks
    import-products-task
    experimental-fashion-sample-products
    shipping-smart-defaults
    shipping-setting-tour
    homescreen
    marketing
    mobile-app-banner
    navigation
    onboarding
    onboarding-tasks
    pattern-toolkit-full-composability
    product-custom-fields
    remote-inbox-notifications
    remote-free-extensions
    payment-gateway-suggestions
    printful
    shipping-label-banner
    subscriptions
    store-alerts
    transient-notices
    woo-mobile-welcome
    wc-pay-promotion
    wc-pay-welcome-page
    launch-your-store
    
    Disabled Features: experimental-blocks
    minified-js
    product-pre-publish-modal
    settings
    async-product-editor-category-field
    product-editor-template-system
    
    Daily Cron: ? Next scheduled: 2024-09-11 06:58:23 +02:00
    Options: ?
    Notes: 224
    Onboarding: completed
    
    ### Action Scheduler ###
    
    Ακυρ?θηκε: 39
    Oldest: 2024-08-12 10:50:05 +0000
    Newest: 2024-08-26 11:00:00 +0000
    
    Ολοκληρωμ?νη: 130.232
    Oldest: 2024-08-10 13:28:15 +0000
    Newest: 2024-09-10 13:24:06 +0000
    
    Αποτυχ?α: 19.229
    Oldest: 2022-01-12 11:52:29 +0000
    Newest: 2024-09-10 13:16:32 +0000
    
    Σε αναμον?: 8
    Oldest: 2024-09-10 13:25:06 +0000
    Newest: 2024-09-11 13:00:31 +0000
    
    
    ### Status report information ###
    
    Generated at: 2024-09-10 15:24:17 +02:00

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hey there, @geonolis! Thanks for contacting us. I’m happy to help you.

    First, to confirm, is this causing any issues on your website? If so, can you share more details about it?

    Have you checked if the discrepancy persists while having only WooCommerce active and no other plugin? The reason I’m asking is because this might be caused by a conflict.

    You can find more about this in this guide.

    Looking forward to your reply.

    Have a wonderful day!

    Thread Starter geonolis

    (@geonolis)

    First, to confirm, is this causing any issues on your website? If so, can you share more details about it?

    It doesn’t cause any issue. I was looking for documentation of the hook woocommerce_update_product , and I found the inconsistency. I usually browse https://woocommerce.github.io/code-reference/index.html for reference, searching for hooks etc. Now I see that what I read there doesn’t correspond to my actual installation.

    Have you checked if the discrepancy persists while having only WooCommerce active and no other plugin? The reason I’m asking is because this might be caused by a conflict.

    I have deactivated all other plugins. The discrepancy remains. The same issue is found both at our production and developing installation.

    The file in discussion class-wc-product-data-store-cpt.php found at https://woocommerce.github.io/code-reference/files/woocommerce-includes-data-stores-class-wc-product-data-store-cpt.html has 2168 lines while my installation file has 2297 lines. Is it normal?

    We are talking about the same version of the same file. According to the first lines, it is @version 3.0.0 :

    <?php
    /**
    * WC_Product_Data_Store_CPT class file.
    *
    * @package WooCommerce\Classes
    */

    use Automattic\Jetpack\Constants;
    use Automattic\WooCommerce\Internal\DownloadPermissionsAdjuster;
    use Automattic\WooCommerce\Utilities\NumberUtil;

    if ( ! defined( 'ABSPATH' ) ) {
    exit;
    }

    /**
    * WC Product Data Store: Stored in CPT.
    *
    * @version 3.0.0
    */

    Thank you.

    Plugin Support omarfpg a11n

    (@omarfpg)

    Hi @geonolis,

    Thank you for the additional details and for bringing this to our attention. It looks like the code references are somewhat outdated. I’ll note this to our docs team to review and address.

    In the meantime, to view the most updated versions, you can also refer to the public GitHub repository; for instance, here’s the reference to the hook in question; as you can see, it works with two arguments:

    https://github.com/woocommerce/woocommerce/blob/d87c3d38d72c12469f1bf9c35364d77076a93e66/plugins/woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php#L351

    Note: You may find this file on Github has a bit more lines than the one on your install. This is because this one already includes some code that will be included in WooCommerce 9.3.0! (for instance, this bit).

    I hope this clarifies things!

    Cheers!
    -OP

    Thread Starter geonolis

    (@geonolis)

    Hello!

    I was expecting that the three-argument-version of class-wc-product-data-store-cpt.php was going to be the prevailing version of the hook.

    My woocommerce e-shop will crash with the two-arguments-version, as my custom plugin needs the 3rd argument of the hook.

    I have created a pull request https://github.com/woocommerce/woocommerce/pull/51345 to add back the 3rd argument.

    Please support.

    Thank you @omarfpg

    Plugin Support omarfpg a11n

    (@omarfpg)

    Hi @geonolis,

    Thank you for the update. I think it’d be easier for you to modify the custom plugin to work with the latest version of WooCommerce. However, let’s wait and see what the developers decide. I saw your GitHub request. You can keep an eye on it for updates from the developers.

    I’ll mark this thread as resolved for now as this is a development question at this stage. With that in mind, you can always ask for insight related to this on either the WooCommerce Advanced Facebook group or the WooCommerce Community Slack. Many of our developers hang out there and will be able to offer insights into your question. You can also seek help from the following:

    I wish I could help more, but hopefully, this gets you going in the right direction to get some further insight/information.

    Thanks!
    -OP

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.