• Resolved radu

    (@radugidei)


    EXPLANATION OF THE ISSUE

    When adding a filter using the hook : woocommerce_my_account_my_orders_actions
    The filter function should receive 2 parameters as seen in the template here https://github.com/woothemes/woocommerce/blob/master/templates/myaccount/my-orders.php#L92

    the $actions (array)
    the $order (order object)
    however, doing a var_dump($order) in the filter function returns NULL on all orders despite having 15+ orders, all valid.

    STEPS TO REPRODUCE THE ISSUE

    add filter to hook : woocommerce_my_account_my_orders_actions
    write function to handle filter that takes in 2 params ($actions, $order)
    dump the contents of $order to screen or attempt to access any properties

    ### WordPress Environment ###
    
    Home URL: https://*redacted*/cms
    Site URL: https://*redacted*/cms
    WC Version: 2.4.7
    Log Directory Writable: ? /home/*redacted*/public_html/cms/wp-content/uploads/wc-logs/
    WP Version: 4.3.5
    WP Multisite: –
    WP Memory Limit: 128 MB
    WP Debug Mode: –
    Language: ro_RO
    
    ### Server Environment ###
    
    Server Info: Apache/2.4.16 (Unix) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 mod_fcgid/2.3.9
    PHP Version: 5.3.29 - We recommend a minimum PHP version of 5.4. See: How to update your PHP version
    PHP Post Max Size: 64 MB
    PHP Time Limit: 30
    PHP Max Input Vars: 9999
    SUHOSIN Installed: ?
    MySQL Version: 5.1.73
    Max Upload Size: 64 MB
    Default Timezone is UTC: ?
    fsockopen/cURL: ?
    SoapClient: ?
    DOMDocument: ?
    GZip: ?
    Remote Post: ?
    Remote Get: ?
    
    ### Database ###
    
    WC Database Version: 2.4.7
    :
    woocommerce_api_keys: ?
    woocommerce_attribute_taxonomies: ?
    woocommerce_termmeta: ?
    woocommerce_downloadable_product_permissions: ?
    woocommerce_order_items: ?
    woocommerce_order_itemmeta: ?
    woocommerce_tax_rates: ?
    woocommerce_tax_rate_locations: ?
    
    ### Active Plugins (5) ###
    
    Koncepto Shop: cu Radu Gidei – 2.4
    Koncepto: cu Radu Gidei – 2.5
    Limiteaza incercarile de logare: cu Johan Eenfeldt – 1.7.1
    Ultimate Maintenance Mode: cu SeedProd – 1.6.3
    WooCommerce: cu WooThemes – 2.4.7
    
    ### Settings ###
    
    Force SSL: –
    Currency: RON (lei)
    Currency Position: left_space
    Thousand Separator: ,
    Decimal Separator: .
    Number of Decimals: 2
    
    ### API ###
    
    API Enabled: ?
    API Version: 3.0.0
    
    ### WC Pages ###
    
    Baz? Magazin: #1914 - /shop/
    Co?: #1915 - /cart/
    Plaseaz? Comanda: #1909 - /checkout/
    Contul Meu: #1910 - /my-account/
    
    ### Taxonomies ###
    
    Product Types: clasic (clasic)
    contemporan (contemporan)
    external (external)
    grouped (grouped)
    modern (modern)
    simple (simple)
    variable (variable)
    
    ### Theme ###
    
    Name: *redacted*
    Version: 1.9
    Author URL: https://www.radugidei.com
    Child Theme: ?
    Parent Theme Name: Enfold
    Parent Theme Version: 3.1.5
    Parent Theme Author URL: https://www.kriesi.at
    WooCommerce Support: ?
    
    ### Templates ###
    
    Overrides: –

    https://www.ads-software.com/plugins/woocommerce/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    If you hook into woocommerce_my_account_my_orders_actions you need to tell it how many arguments your function it expects or it will indeed be NULL.

    See the documentation for add_filter and add_action

    Thread Starter radu

    (@radugidei)

    Thanks Mike, solves it
    Sorry for posting to issue tracker too, only realised afterwards it might be more appropriate to post here.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘My account -> My orders hooks not passing $orders’ is closed to new replies.