The error is indicating that a method function (get_attribute()) is attempting to be called on a variable that is set to null. This means that the $product_object variable is not populated with an instance of a class that has a method definition for get_attribute(), but rather is null.
You’ll need to figure some other way to get the current product object. If you’re in the admin editing a product, then you can get the product ID from a query parameter, and create the object using wc_get_product(). If you’re on the frontend looking at a single product, then you can get the product ID from get_queried_object_ID().
Related Posts:
- Inserting Gravity Form checkbox values into Advanced Custom Fields [closed]
- The values of custom fields are not available functions.php
- Problem with ACF shortcode with Repeater Field in WordPress? [closed]
- ACF: how do I get the fields and its values of a specific group?
- Download PDF after CF7 form submission
- How to create an ACF shortcode with Repeater Field in WordPress? [duplicate]
- HTML Special Characters in URL string [closed]
- Show ACF field with link to ultimate member profile/WordPress user profile below the post (single post layout)
- How can I count ACF sub_field with a certain value
- Problem with adding custom CSS class to image in ACF Photo Gallery plugin [closed]
- Delete images from media library when user deletes an image from ACF Gallery
- Advance custom fields variable with if statement & Function
- PHP/CSS: Shortcode won’t display correctly, and only displays in the head (before content)
- Page returning ID from array, how to return the correct values for post in acf wordpress
- ACF Date fileds to Age Convert [closed]
- Custom WordPress Function – Adding items from Foreach Loop into an array and Updating Field based on array of IDs (ACF + WooCommerce)
- Creating posts with php-script + csv
- ACF number less than comparison not working
- Put ACF function output code the_terms
- Modify previous and next text from pagination links
- Calling a method from functions.php on a click of a button
- How to redirect users to custom lostpassword page?
- How to change featured content to a different tag in WordPress Twenty Fourteen?
- Can I write ‘RewriteCond’ using ‘functions.php’?
- How do I create comment-reply-button using element not
- How to add 2 posts under another post? Formatting should be intact
- WordPress menu deletes when trying to add a hook
- Overriding a theme redux file in child theme
- Validate a users email address when using gmail to register
- Advanced Custom Fields Image Field returning ID instead of URL [closed]
- Get widget settings function?
- Making Quote Plugin more efficient
- Adding tawk.to code just before body tag on functions.php file
- allow subscribers to see private posts without plug in
- add_action shortcut?
- remove wp floating submenu in wp dashboard
- Fatal error: Uncaught Error: Call to undefined function test()
- Get page that displays all children of taxonomy parent
- Return a numerical function value in Customizer controls
- How can I get the values of my WordPress $wpdb query in Jquery?
- Function to capture a value and store it in a variable
- Adding a widget function into the php theme file
- My new button is in the wrong place
- Checking array against author id in loop
- theme_root returning a truncated URI
- Call to undefined method – Download Monitor
- How can I make an object available through the entire site?
- WordPress admin-ajax.php
- How do I modify the custom footer text and get theme version number to show in wordpress admin?
- How to use html inside a functions.php code?
- Nested “do” and “add” Actions is possible?
- linking stylesheets and scripts with functions.php
- ACF put a comma after the last repeater field value [closed]
- How can I hook into the wp_mail function used by BackWPup?
- How to get current post category details inside “loop”?
- how to enqueque code in a php file from functions.php
- Only load certain artists on this page
- Get the alt text of the image in a array
- Convert all uploaded PNG files to PNG-8 format
- Make table disappear when fields are left blank?
- How to Redirect Buddypress Directories To Login Page For Non Logged in Users
- Woocommerce order status payment
- How to define a rule in functions.php that ONLY disables the default wp functionality that undesirably changes ‘&’ to ‘#038;’?
- Unzip file in functions.php, and add it to cron
- Add Block Before Entry Title Using PHP
- Display logged in user name and lastname on page
- How to Add a cutsom slug to my custom author role
- Dynamically populate parameter in Gravity Forms using PHP
- Get main parent category for post (WordPress/Advanced Custom Fields)
- How to output the taxonomies that are assigned to each custom post?
- Having trouble creating two shortcodes, one for logged in user and one for visitors
- ElseIf Statement with ACF Group field
- How to escape echo for input tag?
- Including user data in “new user notification email”
- Display current user metadata on WordPress page
- Reload page with a different shortcode when a user selects from a dropdown
- Get list of posts from attachment
- Refresh page after login with litespeed cache
- Woocommerce Add custom “Add to cart button” in single page with tags
- Populate Posts based on category selected using AJAX that means without page refresh
- remove_action() not working in page template – Genesis
- Can’t get_users info by using json_encode
- What is wrong in this code?
- Modify php code to pass a page id as a parameter in order to create a breadcrumb
- Show custom default avatar instead of gravatar
- Removing all my hardcoded URLs with get_site_url()
- WordPress 2014 Theme – Featured Content with multiple tags?
- Highlight main menu when on specific posts or pages
- the_post_thumbnail unless video id is added
- ajax form function error
- Display custom meta box in my template file
- ACF | WooCommerce | Theme Development | How to include a /template-part/ that makes use of ACF’s on a custom WooCommerce homepage?
- Woocommerce – Shipping tax class based on cart items not using the highest tax available
- How to display the date under the post title?
- Simple Probléme in wordpress
- How can I get values from a custom post type depending on where I click on my SVG map?
- a problem in class in class-wp-hook.php
- change title of page dynamically
- Function for Post Creation plugin for Gravity Forms
- Modify the permalink structure for a specific category