I
I
Iskander Mammadov2015-01-03 12:36:26
PHP
Iskander Mammadov, 2015-01-03 12:36:26

How to customize the output of Woocommerce products?

I'm trying to use woocommerce in my theme to create a store.
Everything was going well, until it came to the moment with the withdrawal of goods. I use this construction:
<?php woocommerce_content(); ?>
but this function uses its own templates to display products. How can I display product information in my layout?
For example, I made this design:

<div class="item">
<img src="img/item1.jpg">
<h3 class="item_item">Гидравлическая тележка Lema LM 20-800x550</h3>
<div class="item_content">
Длинна вил, мм; 800
Грузоподьемность, кг; 2000
Производитель; Lema
Вариант исполнения; Коротковильные
Ширина вил, мм; 550
</div>
</div>

How can I display information in this structure?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WP Panda, 2015-01-03
@alexgugr

woocommerce_content - looks like this
https://docs.woothemes.com/wc-apidocs/source-funct...
so it returns a loop with connected output templates.
To change the output, you need to change the templates.
You can change it through the filter when connecting the template, checking what is connected
Example of replacing the template of the field for selecting the quantity of goods

/**
 * Замена спиннера
 * @param $located
 * @param $template_name
 * @param $args
 * @param $template_path
 * @param $default_path
 * @return string
 */
function filter_сr_woo_quantity_inputs( $located, $template_name, $args, $template_path, $default_path ){
    if('global/quantity-input.php' === $template_name ) {
        return __DIR__ .'/cr-quantity-input.php';
    } else {
        return $located;
    }
};
add_filter( 'wc_get_template', 'filter_сr_woo_quantity_inputs', 10, 5 );

But this method, it is mainly for plugins, WooCommerce itself provides an excellent opportunity for this, just drop a folder called woocommerce into the theme of the WooCoommerce folder, and the contents of the templates folder from the plugin into it, and there change the output templates as you like, shove any kind of layout, they will come out.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question