Tagged: woocommerce 3
-
AuthorPosts
-
April 8, 2017 at 10:31 pm #774722
Since updating WC I have issues with using the shortcode [product_page id=”xx”]
I get the following error:
Fatal error: Call to a member function get_upsell_ids() on null in /public_html/wp-content/plugins/woocommerce/includes/wc-template-functions.php on line 1324
Not sure if this is a theme conflict or issue with Woo.
Thanks in advance for your help
April 8, 2017 at 10:48 pm #774725Hey MIMMT,
Are you trying to use the WC shortcode in the Advanced Layout Editor, or the Default Editor?Best regards,
MikeApril 8, 2017 at 10:54 pm #774728Hi Mike
Advanced Editor. I just changed theme and it renders fine so it looks like a theme issue.
April 9, 2017 at 12:27 am #774753@mimmt I cant confirm that issue. Despite the fact the layout will be awful while using that shortcode with the advanced editor there is no error. Try to deactivate all plugins except woocommerce and test again.
April 9, 2017 at 8:19 am #774801The layout renders well and I have a carbon copy of my site in my development environment.
The front end
https://www.dropbox.com/s/6nypq92l0dozy4n/Screen%20Shot%202017-04-09%20at%2008.14.00.png?dl=0Advanced editor view
https://www.dropbox.com/s/lsp9vnlqr2zrs5e/Screen%20Shot%202017-04-09%20at%2008.14.26.png?dl=0
https://www.dropbox.com/s/a4gfvbp541xhwkx/Screen%20Shot%202017-04-09%20at%2008.14.51.png?dl=0Front end after WC V3 update
https://www.dropbox.com/s/5l0264memdzxn9o/Screen%20Shot%202017-04-09%20at%2008.15.24.png?dl=0- This reply was modified 7 years, 8 months ago by MIMMT.
April 9, 2017 at 9:32 am #774831@mimmt sorry my fault. I was expecting an error message onscreen. Quick look in the php error.log reveals the error. Bug confirmed and caused by Enfold replacing the display of upsell products (Content Buffering !). The called function woocommerce_upsell_display() has changed in WooCommerce 3.0 from the classic WP-Query approach to the new CRUD approach.
Either you don’t use the product_page shortcode or you skip the display of upsell products if the shortcode is used by using the following temporary fix in the functions.php file of a child theme
add_action( 'wp', 'mmx_fix_enfold_for_woo3' ); function mmx_fix_enfold_for_woo3() { global $post; if( has_shortcode( $post->post_content, 'product_page') ) { remove_action( 'woocommerce_after_single_product_summary', 'avia_woocommerce_output_upsells', 21); } }
Although the issue is caused by replacing the call to woocommerce_upsell_display() with a custom call it is NOT a problem of Enfold. I just tested it with other themes and get the same result if I remove the original hook and add my own. I will keep you informed.
- This reply was modified 7 years, 8 months ago by mensmaximus. Reason: Reason of issue corrected
April 9, 2017 at 10:37 am #774872Thank you so much @mensmaximus. This worked out great.
April 9, 2017 at 11:47 am #774892I have narrowed the issue down to a “timing” problem (priority of hooks) and reported the issue to woocommerce. Anyone interested in this issue can follow it at github.
April 9, 2017 at 6:56 pm #775073Thanks again. I’ll keep an eye on your github post.
April 9, 2017 at 7:20 pm #775085Hey!
Please feel free to create a new post if you need something else regarding our theme
Thank you very muchRegards,
Basilis -
AuthorPosts
- You must be logged in to reply to this topic.