You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Elementor Pro与Porto主题模板编辑异常及WooCommerce报错求助

Elementor Pro + Porto主题 + WooCommerce 随机编辑异常问题求助

问题现象

  • 编辑Porto主题模板时,偶尔无法进入Elementor页面编辑器,仅显示某一产品的纯HTML内容,无其他代码
  • 问题无规律随机出现,未对站点做任何修改时也会自行恢复

核心报错

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

已执行的排查操作

  • 删除报错代码行,问题未解决
  • 在测试站点禁用所有插件(仅保留基础Elementor),可正常进入编辑页面,但保存时触发500服务器错误
  • 调整wp-config.php中的PHP内存限制参数,500错误仍存在
  • 联系主机服务商、Porto主题开发者、WooCommerce官方技术支持,均未找到有效解决方案

报错关联代码片段

// 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 ) ),
    );
}

站点环境

  • WordPress版本:5.2
  • 核心插件:WooCommerce、Elementor Pro
  • 主题:Porto

内容的提问来源于stack exchange,提问作者George Charles

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.25 16:36:10