WordPress.org

Forums

WooCommerce - excelling eCommerce
Calling the Product Dimensions in Short-Description.php (1 post)

  1. lozadaOmr
    Member
    Posted 1 year ago #

    I tried calling the product dimension on the Single Product Page, inside the Short-Description.php, but I am getting the error

    Fatal error: Call to a member function get_attributes() on a non-object in C:\xampp\htdocs\woo2\wp-content\plugins\woocommerce\templates\single-product\short-description.php on line 14

    This is the code on my short-description.php

    <?php
    /**
     * Single product short description
     *
     * @author 		WooThemes
     * @package 	WooCommerce/Templates
     * @version     1.6.4
     */
    
    if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    
    global $post;
    global $woocommerce;
    $attributes = $product->get_attributes();
    
    if ( ! $post->post_excerpt ) return;
    ?>
    <div itemprop="description">
    	<?php echo apply_filters( 'woocommerce_short_description', $post->post_excerpt ) ?>
    	<?php echo $product->get_dimensions(); ?>
    </div>

    I tried calling it using

    <?php echo $product->get_dimensions(); ?>

    I know that the dimensions can be viewed on the additional details tab, but I only need to appear along with the short description

    http://wordpress.org/plugins/woocommerce/

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce - excelling eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic