Site Analysis
Твиты
Афоризмы
Цитаты
Новости
Analysis

WP+Woocommerce – edit widget featured products

Default view woocommerce widget - "featured products":

 

 

Change interface - replace price and add new parameters (quantity stock, short description). Standart and new:

 

 

 

Widget “featured products” show goods, which selected symbol “stars” in adminpanel:

 

Our change will work after update system if create new template "content-widget-product" in current theme. File - 

wp-content/plugins/woocommerce/templates/content-widget-product.php

copy to -

wp-content/themes/YOUR-THEME/woocommerce/content-widget-product.php 

 

Default code "content-widget-product.php " for Woocommerce 3.0.3:

 

Here use next parameters:

  • $product->get_name() - product name;
  • $product->get_permalink(- prepare product link;
  • $product->get_image() - image code block 'img';
  • $product->get_average_rating() - html block ratings;
  • $product->get_price_html() - html block price.

Parameters for new template:

  • $product->get_price() - price product;
  • $product->get_short_description() - short description product;
  • $product->get_description() - full description product;
  • $product->get_date_created() - date create product;
  • $product->get_stock_quantity()  - quantity products in stock.

 

Bootstrap snippets for Woocommerce widget featured goods:

 

Style for colorized attributes and remove padding:

 

Tags:
1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 9.00 out of 10)
Loading...

Leave a Reply