Products in WooCommerce are a custom post type, so this should work:
$url = get_permalink( $product_id );
You can treat that $product_id as a postID (that’s what it is), so you can use it with other normal WP functions, like:
echo '<a href="'.get_permalink($product_id).'">'.get_the_title($product_id).'</a>';
Related Posts:
- How can I see all the actions attached to an “add_action” hook?
- I found this in a plugin. What does it do? is it dangerous?
- How to do I get a list of active plugins on my wordpress blog programmatically?
- How to Display Product specific to a category with WooCommerce Plugin? [closed]
- How to add field for new site-wide option on Network Settings screen?
- Where is the best place to use add_filter
- Redirection plugin – how to let the editor access the ‘redirection’ menu?
- Can I make plugins required?
- Problems with autoloading classes via sp_autoload_register / maybe interfering WP-specific autoloader
- Advice on naming files for a plugin
- How to make search engine index PDF files? [closed]
- Self Develop or Plugin as first option?
- Is there any debug toolbar that shows whick hooks are called for the current page in WordPress?
- Adding a Variable Product in WooCommerce Programatically
- For performance is it better to build custom functionality into the theme or a plugin
- Output in XHTML or HTML 5 for plugins?
- Can we completely remove the WordPress Sitemaps (WordPress 5.5)?
- WordPress tips for speed and performance [closed]
- Save and retrieve custom plugin options value
- Best WP cache plugin for large site [closed]
- How much should I charge for creating a WordPress plugin? [closed]
- Add Archive Page Template via Plugin
- How to access options of Redux framework in front end
- Using tabs for wordpress plugin
- How do I add a widget programmatically to a newly created site (WPMU) within a plugin?
- How to get user-meta from Social Login registered users?
- How can I save repeatable fields with one value inside an array?
- Duplicate settings of master blog to slave blogs in WP multi-site installation
- Cannot strip JW Player shortcode?
- Environment Specific Options Token
- Tracking last login and last visit
- Rename existing old uploaded images containing accented French characters (not during upload)
- Woocommerce: change user role after completing order
- Prevent page slug from interfering with custom post type archive permalink?
- Automatic updates not working/plugins not installing
- append stylesheet via shortcode
- Send batch of posts as HTML Email?
- How to list all active and specific shortcodes in wordpress
- Translate third party plugin and save translation files in custom theme
- Trying to add admin file upload form plugin
- wp_verify_nonce() why return false?
- What’s the best plugin for allowing javascript in a post or page? [closed]
- Is it possible to filter the wp_footer() scripts, read the content, and insert them inline?
- Remove action from woocommerce barcode plugin [closed]
- Plugin “Meta Box”: Implementing meta boxes in custom post type
- register_theme_directory somehow “fails” when folder is outside of WP-Folder
- Disable / Deregister all JS from all plugins
- Do extra plugin files get deleted during an upgrade?
- Adding a custom line of text to php code
- How to call bind function in wordpress actions or hooks
- clean wp_options table unused rows
- plugins_url() incorrectly returns a url with www subdomain
- Compatibility with RTL installations
- WordPress plugin for mail subscriptions [closed]
- Plugin allowing for artists, events and venues
- Disable Other Plugins on my Custom Post Type?
- Passing RichText attributes to function onChange
- Getting media library popup in custom plugin admin page
- Using ACF to display data on all pages
- Creating a plugin that will add options. Where should the options menu pages go?
- shortcodes displaying outside of content area with echo statement, not what I wanted [duplicate]
- Shortcode is not working in homepage page template (custom front page)
- wp_authenticate but not logged in
- How to write one comment and publish on every post using database or plugin?
- How to automate wordpress plugin activate and deactivate by php logic?
- Prevent WordPress plugin from connecting to its server
- How to create PDF file upload field for post like meta box field admin side?
- ‘wp_login’ action hook not working with wp-login.php file
- Where to access the available plugin/WordPress updates?
- HTML in WooCommerce settings
- Can WordPress Plugin Directory Cache Delay the Upload of Images?
- Redirecting to home page after login as custom role WordPress
- Only allowing some email addresses to create an account
- Where (or when) should I register a new taxonomy?
- Widget with same content across several websites
- Hook (or other way) to find out when another plugin is activated / installed
- Issue using wp-load.php in WordPress Plugin Development
- How to change custom post type pemalink Hierarcy
- Get post values of form created by widget in sidebar
- WordPress plugin compatibility explaination when wordpress releases its new version (theoretical)
- Calendar Solution: Handling upcoming Dates with Posts?
- get_post_type on post.php
- How to save generated JWT token to cookies on login?
- Assign / update custom field value for all posts (How can I assign only to posts without custom field value?)
- How to enable specific plugin only based around shop manager role?
- Fixing WordPress’s Bug (failed to send buffer of zlib output compression) results in “White Screen of Death”
- How to tie dark mode with prefers-color-scheme webkit? [closed]
- how to oauth1 Wp plug-in revoke/reset.?
- Disable woocommerce cookies and delete cart data automatically
- Why required field not working in Country dropdown in WooCommerce –
- WordPress: cleaning media library
- How to identify the names of deleted plugins?
- Consolidate plugin functionality into a theme
- Why can’t I access my Intranet LDAPS with NADI?
- qTranslate remove default directory from link
- WordPress adding a menu page when activating a plugin
- How to Display Taxonomy Custom Meta Box Data in Archive Page?
- Cannot display settings field
- Custom User meta field display
- WordPress 4.2.1 pre_get_comments doesn’t work after update