WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. lozadaOmr
    Member
    Posted 6 months 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/

Reply

You must log in to post.

About this Plugin

About this Topic