Hello,
Is there a way we can add some text like 20 to 30 words on category or shop page in woo commerce currently its only showing title on category page
Help some one
Hello,
Is there a way we can add some text like 20 to 30 words on category or shop page in woo commerce currently its only showing title on category page
Help some one
I meant to say We need to show product description on category page
That category page with the products inside is:
woocommerce >> templates >> content-product.php
And you can find that only function to show the Title inside this page as:
<h3><?php the_title(); ?></h3>
After that line you can add your own lines:
<br /><?php echo $product->get_sku(); ?>
<br /><?php echo apply_filters( 'woocommerce_short_description', $post->post_excerpt ) ?>
These will display the SKU and the short-description of the product.
Btw, this is just a quick hard-coded method, you can try to add these functions to the hook on that page in your theme's functions.php.
add_action('woocommerce_after_shop_loop_item_title','woocommerce_template_single_excerpt', 5);
As it is mentioned in that hooks comments section that the PRICE is already hooked in there.
Okay that works can you tell me how can you show like 20-30 characters and then read more link?
I didn't see this question before I posted a duplicate question. I also need the same solution as mdlsumair. Is there any way we could take advantage of the "Insert More Tag" in the visual editor of the product (Product Short Description)?
Clients want short description on Shop pages and then more details within the single product pages.
Here is what I came up with:
content-product.php - This is the shop page and the code below will show the info from the short description box.
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php
/**
* woocommerce_after_shop_loop_item_title hook
*
* @hooked woocommerce_template_loop_price - 10
*/
do_action( 'woocommerce_after_shop_loop_item_title' );
?>
<?php echo apply_filters( 'woocommerce_short_description', $post->post_excerpt ) ?>
<a class="more" href="<?php the_permalink(); ?>">Read More >></a>
<?php do_action( 'woocommerce_after_shop_loop_item' ); ?>
short-description.php - This is for the single page view of a product. I switched this to display from the main content area instead of the short description info.
global $post;
if ( ! $post->post_excerpt ) return;
?>
<div itemprop="description">
<?php the_content(); ?>
</div>
Hope this helps!
hello,
I´m having a similar problem.
I want to show the short description in the checkout between the product title and the quantity. the code I have so far is:
<?php
if (sizeof($woocommerce->cart->get_cart())>0) :
foreach ($woocommerce->cart->get_cart() as $item_id => $values) :
$_product = $values['data'];
if ($_product->exists() && $values['quantity']>0) :
echo '
<tr class = "' . esc_attr(apply_filters('woocommerce_checkout_table_item_class', 'checkout_table_item', $values, $item_id ) ) . '">
<td class="product-name">'.$_product->get_title().$woocommerce->cart->get_item_data( $values ).'</td>
<td class="short_description">'.$_product->get_post_data().$woocommerce->post->get_post_excerpt( $values ).'</td>
<td class="product-quantity">'.$values['quantity'].'</td>
<td class="basispreis">'.$_product->get_price().$woocommerce->post->get_post_excerpt( $values ).'</td>
<td class="product-total">' . apply_filters( 'woocommerce_checkout_item_subtotal', $woocommerce->cart->get_product_subtotal( $_product, $values['quantity'] ), $values, $item_id ) . '</td>
</tr>';
endif;
endforeach;
endif;
do_action( 'woocommerce_cart_contents_review_order' );
?>
I would be so thankful for your help!
Hello,
I am using WP-Flexishop, and i need to add description to each post category. But under description it says "The description is not prominent by default; however, some themes may show it." and the theme I am using does not display it.
What can i do for description to be displayed. Please Help! Will be very grateful.
@ManusH Thanks for the hardcode method, it works a treat.
The only problem is I do not know how to style the paragraph tag.
<div itemprop="description">
<p>Box quantity 75</p>
</div>Also the description is appear under the page title, anyway I can remove this without using display none
thanks
Hi, I am trying to do all mentioned above: Have the title, price and a brief excerpt on the list pages, however I would like that info to appear on image hover. Does anyone know the additional steps to add an action to make these items appear on a mouse hover? I'm sure this is the correct template file that I would need to edit...any help would be greatly appreciated!
Thanks!
@Fatz : I've coincidentally come across your posts here, on github, and on the phpforum.de while trying to solve the same problem...
Have you finally figured this out?
@forgetfuljames
dear James,
finally I had to contact a php-programmer to find a solution for the product description. But now it´s working very nicely and totally uncomplicated for my customer too. I couldn´t find another solution in the www, but now I´m very happy with that.
If you like to have the code consider a small donation to me and I will send it to you. you can write me at my mailaddress: ShrifeeDesign(at)gmail.com
greetings
Steffi
@fatz: Thanks. I used
$productshort_cart = $_product->post->post_excerpt;
echo $productshort_cart;
to get what I needed. Wish I could have saved you the hassle :/
@forgetfuljames
yes, indeed I´m having the same code! ;)
working very nicely isn´t it?
@fatz: yes. i ended up using
echo var_dump( $values );
to look at the entire $values variable — WC_Product class has a lot to offer. :)
Hey guys!
Is there any way to pull custom attributes for the product, instead of the short description?
Thank you!
@oksanaar: This probably should be a new thread, but...
...from within the WooCommerce cart contents loop (the $_product variable is then available to you) you can use the get_attributes( 'attribute-slug' ) function to retrieve any product attribute, where 'attribute-slug' is any attribute slug, like so:
<?php echo $_product->get_attribute( 'attribute-slug' );?>
Thanks! I will start a new thread and comment my response there.
Hi there,
Can anyone please let me know how can i get the product category along with product name on the cart page?
This is how I need and modify :
<tr>
<th class="product-remove"> </th>
<th class="product-thumbnail"> </th>
<th class="product-name"><?php _e( 'Product', 'woocommerce' ); ?></th>
******This is the update that i need on cart page********
<th class="product-cat"><?php _e( 'Category', 'woocommerce' ); ?></th>
<th class="product-price"><?php _e( 'Price', 'woocommerce' ); ?></th>
<th class="product-quantity"><?php _e( 'Quantity', 'woocommerce' ); ?></th>
<th class="product-subtotal"><?php _e( 'Total', 'woocommerce' ); ?></th>
</tr>
[Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]
Thanks a lot
You must log in to post.