最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

customization - Woocommerce Product page edit

programmeradmin1浏览0评论

I am making an online store with every category using a specific page template; that's all done, but now, I want to edit the layout of that page template.

As such, every product will have:

  • a name,
  • an image,
  • a short description;
    I would like the product description to be between the product name and product price tag,
  • a price tag, and
  • a Add to Cart button.

My challenge: I have no idea about how to get started and need assistance in that regard.

What file do I possibly have to clone and or edit?

I am making an online store with every category using a specific page template; that's all done, but now, I want to edit the layout of that page template.

As such, every product will have:

  • a name,
  • an image,
  • a short description;
    I would like the product description to be between the product name and product price tag,
  • a price tag, and
  • a Add to Cart button.

My challenge: I have no idea about how to get started and need assistance in that regard.

What file do I possibly have to clone and or edit?

Share Improve this question edited Dec 25, 2016 at 16:41 nyedidikeke 4921 gold badge6 silver badges15 bronze badges asked Mar 29, 2016 at 13:12 TLRTLR 351 silver badge8 bronze badges 0
Add a comment  | 

1 Answer 1

Reset to default 5

WooCommerce allows you to override its default templates. All templates are located in a woocommerce/templates folder. All you have to do is to create a woocommerce folder within your theme’s directory, and in this folder duplicate the files you’d like to override.

If you want to update the markup then you will need to copy archive-product.php and content-product.php files. If you just want to show a little description between the product name and price, then you can simply put following code into your theme's functions.php file.

function show_product_summary(){
    $product_summary = get_the_excerpt();
    echo '<div class="product-summary">'. substr( $product_summary , 0, 30 )  .'</div>';
}
add_action('woocommerce_shop_loop_item_title', 'show_product_summary', 10, 2);

You will see the product summary like below on product listing page.

Here is official blog post which will give you quick walkthrough.

发布评论

评论列表(0)

  1. 暂无评论