Having a recurring issue relating to Elementor Pro, for the life of me, I can't figure out what is causing and triggering this issue. When editing a Porto theme template, normally we get thrown into the Elementor page builder, occasionally it shows one of our products in HTML format without any other code included.
The error messages we receive are
Error Details
=============
An error of type E_ERROR was caused in line 3444 of the file /www/buildersmerchant_356/public/wp-content/plugins/woocommerce/includes/wc-template-functions.php. Error message: Uncaught Error: Call to a member function has_dimensions() on null in /www/buildersmerchant_356/public/wp-content/plugins/woocommerce/includes/wc-template-functions.php:3444
We have removed the line of code to see if it fixed the issue but it didn't. We have also contacted the theme developer who notified us it might have been plugin conflicts. We disabled all plugins including Elementor Pro but keeping the standard Elementor on our staging site. This got us to the page we normally see but when try to update our changes it throws a server 500 error.
We believe the server 500 error to be related to PHP Memory limit, we have increased this is in our WP_CONFIG file and it still didn't fix the issue. We have also contacted our hosting provider who couldn't find a solution to the problem.
Now the confusing thing is, without any changes done to the site, it randomly breaks then fixes itself again. The theme developer hasn't been able to resolve this issue and is confident the problem lies with woocommerce. I have reached out to woocommerce and they have tried several fixes. I have attached a YouTube video of the problem. https://www.youtube.com/watch?v=UuXoTlt_NK0
The section of code that throws the error is this
// Display weight and dimensions before attribute list.
$display_dimensions = apply_filters( 'wc_product_enable_dimensions_display', $product->has_weight() || $product->has_dimensions() );
if ( $display_dimensions && $product->has_weight() ) {
$product_attributes['weight'] = array(
'label' => __( 'Weight', 'woocommerce' ),
'value' => wc_format_weight( $product->get_weight() ),
);
}
if ( $display_dimensions && $product->has_dimensions() ) {
$product_attributes['dimensions'] = array(
'label' => __( 'Dimensions', 'woocommerce' ),
'value' => wc_format_dimensions( $product->get_dimensions( false ) ),
);
}
We use wordpress 5.2 with woocommerce, elementor pro and porto for our theme.
Would appreciate any insight or help.
Thanks