Category Archive for "woocommerce"

How to use WooCommerce’s default price at any custom template

To use WooCommerce’s price in your custom theme template open the template file and use the following code and see the magic. Example <?php global $post, $product; ?> <span itemprop=”price” class=”price”><?php echo $product->get_price_html(); ?></span> For default price template file of woocommerece you can look at folloiwng location yourtheme/woocommerce/loop/price.php. Open the file up and see the code used for the same <?php global $product; ?> <?php if ( $price_html = $product->get_price_html() ) : ?> <span class=”price”><?php echo $price_html; ?></span> <?php endif;…

Read More

How to use hooks (actions and filters) in wordpress and woocommerce

What are hooks? Hooks are helpful in WordPress which allow you to manipulate code without editing core files. It is used extensively used throughout WordPress and WooCommerce by developers. Two types of hook: actions and filters. Action Hooks allow you to insert custom code. Filter Hooks allow you to manipulate and return a variable. There are lot of excellent article on hooks and filters as follows: 1) 2) 3)–wp-27373 4) Using hooks If you use a…

Read More