The solution was simple, in the end. After grabbing the item ID, I had to query the product class:
$productmeta = new WC_Product($id);
$sku = $productmeta->post->sku;
Then insert $sku instead of $id on the output. It took me about 30min to figure that out. Perhaps it’ll be useful to someone else in the future. I placed the final code on Pastebin.
Related Posts:
- Best way to overide plugin CSS?
- Ways to create a paid wordpress plugin?
- How to include a plugin’s php file to another plugin functions file [duplicate]
- How to register_sidebar() without messing up the order?
- How to find out if option exists but is empty?
- Template for different category on woocommerce product [closed]
- Reduce nonce lifespan
- Trigger a custom wordpress plugin with a linux cron
- Add Products to user’s ID Woocommerce
- Add_rewrite_rule doesn’t add custom url in plugin
- Allow a userclass to save a page as a draft – but not publish w/o admin approval
- Fatal error: Uncaught Error: Call to undefined function get_userdata()
- Custom options page checkbox will not save, despite working with text
- How to add inline css/js inside a shortcode
- taxonomy_template filter do not loads custom taxonomy template properly
- Is this plugin being loaded before file.php, subsequently not allowing me to use certain functions?
- Display comments of users on single page
- How do I write into a file (css)
- What is an arbitrary URL?
- Loco Translate: Custom Post and Custom Taxonomy Labels not translated in wp-admin menu
- I am getting error message on accessing menu-endpoint
- Allow users of my plugin to define their own shortcode rather than use mine?
- Set featured image randomly from WordPress Database on post submission
- Timed Exam test for candidates [closed]
- There has been a critical error on your website. Please check your site admin email inbox for instructions.Learn more about debugging in WordPress [closed]
- Woocommerce Deposit, then random payments until product paid in full [closed]
- Submit page limited in time to upload image
- Modal suddenly disapearring [closed]
- media page returnig to 404 in rtmedia [closed]
- Remove Woocomerce shop page
- Setting up PubSubHubbub (PUSH) with WordPress
- Plugin can not display in my custom theme
- How do I show a different homepage to logged in and non-logged in users?
- Check if SEO plugin installed
- What is the best way for showing a grid of customer logos?
- Is there any way to make myself an admin?
- Plugin Theme CSS [closed]
- General questions re: WordPress and WP plugins [closed]
- populating a form field with output from a custom plugin function
- Using ‘mysqli_connect’ ‘crashes’ WordPress client-side
- Measure and limit file uploads
- Short messages widget [closed]
- Yoast Force Rewrite Crashed Site [closed]
- Is there a way to add custom endpoint to specific page only
- IF condition based on wp_remote_get output
- shortcode not return any thing in Gutnburg
- Change in one place the data about the company, which are placed on several pages
- How do I add a plugin dependency to my customized theme?
- wp_trash_post hook – problem with page updating if using wp_die
- Form Plugin for Api Requests which is used via Shortcode
- rewrite file to wordpress
- WordPress Url setting
- When Installing a Plugin Where do I Move Template Files to?
- What would make the plugin update process to complete but don’t report as such?
- AZindex related help needed
- WordPress slider that allows image, headline, text, and button?
- Contact Form 7 is not redirecting the “Thank-You” page with the removal of CSS and JS of plugins
- WordPress search input in database, to edit information via form and update the database
- Remove a div class with condition
- How Can I Increase Breadcrumb Position Count (Starting From 2)?
- BS Authorize.net Problem (Payment in hanging if customers is not logged in)
- PHP Error message Upload images to remote server
- Better search on WordPress.org Plugins?
- Avoid duplicate posts with xml rpc
- No route was found matching the URL and request method
- WP_get_image_editor resizing images in a foreach loop
- WP core and plugin updates fail AWS
- Load my Inline js footer area
- CMB2 Output Select Box Chosen Option
- Custom product page’s style for printing
- Remove action added in plugin class from theme
- wc_get_product_terms() throws “Notice: Undefined offset: 0”
- Use WordPress Site For Email List Functionality
- Why does WordPress use cookies for /wp-admin and /wp-content/plugins for non-admin users [duplicate]
- How to add subdomain to htaccess
- Create a two column content
- Can’t get or display post thumbnail in wordpress
- Custom User Notice Upon Login
- How to validate field when create post
- Keeping original URL
- How to publish adobe edge animation to custom wordpress plugin
- Adding an onchange event to a custom dropdown menu in WordPress
- How to add jquery to my custom post type wp plugin
- WordPress list child pages of custom post type
- Update post meta not working on wp_postmeta
- Home not showing in yoast breadcrumb
- Contact Form 7: custom validation [closed]
- Adding a Filter to Sidbar Login Plugin to Change Login Button Lable
- Trouble Removing Plugin [closed]
- Output plugin post like system count [closed]
- How to develop an extension for a simple form post and post back? [closed]
- Hide Pages WooCommerce [closed]
- What can I do to customize a widget provided with this plugin? from where have I to start?
- Javascript as Jquery Function Call?
- Elementor with system colors instead of kit colors [closed]
- Shortcode inside a redirect [closed]
- Attachement title in wpallimport
- Block registration with viewScript
- WordPress error Fatal error: Uncaught TypeError: Argument 3 passed to Automattic :get_setting_for_feature() [closed]
- Hidden Elementor sections slow down website. How to fix this? [closed]