Home › Forums › Support › Add PHP code to menu item This topic has 6 replies, 3 voices, and was last updated 7 years ago by Tom. Viewing 7 posts - 1 through 7 (of 7 total) Author Posts March 16, 2017 at 1:17 pm #293049 Amos Hello. i want to add a php code to menu item (primary) it is possible? March 16, 2017 at 1:21 pm #293051 LeoStaff Customer Support Hi there, What are you trying to add? It maybe easier to use a plugin like this: https://wordpress.org/plugins/if-menu/ Let me know. March 16, 2017 at 1:28 pm #293057 Amos i want to add the first code : https://docs.woocommerce.com/document/show-cart-contents-total/ inside menu item. i dont want to use 3rd party plugin for this. March 16, 2017 at 1:46 pm #293062 LeoStaff Customer Support I don’t think that code is for you to add to the menu as it says it’s for template. This is probably what you are looking for: https://en-ca.wordpress.org/plugins/woocommerce-menu-bar-cart/ Let me know if this helps. March 16, 2017 at 6:02 pm #293154 TomLead Developer Lead Developer It’s not possible to add PHP to menu items. You would have to turn the PHP into a shortcode, then use a plugin like this: https://en-ca.wordpress.org/plugins/shortcode-in-menus/ March 17, 2017 at 2:16 am #293304 Amos Thank You Tom and Leo. i am using the code inside the “After Header Content” Hook and it is look good also. Tom there is any update about the woocommerce add on ? ๐ March 17, 2017 at 9:48 am #293456 TomLead Developer Lead Developer Nothing new yet ๐ Author Posts Viewing 7 posts - 1 through 7 (of 7 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In