I have written a function which will display a date picker and a select box. I want this function output to be displayed on woocommerce single product page. So I assigned my function to a hook woocommerce_after_single_product_summary and I am not seeing any fields appearing in the product page. Can anyone please help?.

so far per my knowledge the function is working fine as I have tested it using its shortcode in a page. Below is the hook I am trying to add, timeslot_display is my function also I have added a screenshot of my function output.

add_action('woocommerce_after_single_product_summary', 'timeslot_display')

enter image description here

  • can you please include your timeslot_display() function definition?
    – Domain
    Aug 10, 2015 at 9:05
  • Here I am building a woocommerce based plugin where the product authors (I have assigned authors to product posts) load their timeslots in user meta. timeslot_display() returns the date and timeslot fields based in user meta according to product author. The output of timeslot_display() is to be displayed on product page.
    – krishna89
    Aug 10, 2015 at 9:10
  • Have you passing any parameter to timslot_display() function?
    – Domain
    Aug 10, 2015 at 9:11
  • no, I am getting the values within the function like user Id from get_current_user_id() kind of functions....based on the current logged in user and posts by the current user.
    – krishna89
    Aug 10, 2015 at 9:15
  • which theme are you using?
    – Domain
    Aug 10, 2015 at 9:18

1 Answer 1


Thanks WisdmLabs. I traced it finally after the discussion. The changes in product page are appearing now. Below is the mistake I have done.I am posting this as it might help others with similar problems. In my plugin I am calling file B in file A using require_once. I have placed my function timeslot_display() and hook calling line in file B which did not give any results. When I copied the entire code of file B to file A, then I am able to see the changes in product page. Not sure why this happened but it worked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.