Support » Plugin: WooCommerce » How to get Column class in template

  • I’m developing a WordPress theme, Here is my HTML template link.
    How can I get column class in my theme woocommerce template. Before we got woocommerce column class from $woocommerce_loop variable. But as you know woocommerce removed that global variable. So what is the alternative to get WooCommerce loop column class in custom templates.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi

    you can still get columns information using filter loop_shop_columns

    please check this:

    I have different column layout in my website, some of my Shop pages have 2 column, some 3, 4 etc. I’m using Visual Composer in my website, Suppose some user add products by VC Element. How can I get the Column Value in my custom template ‘content-product.php’. I added 2 column product loop and class is showing with woocommerce class. Check the link below

    Now I want to get this class in content-product.php

    Hi @infloway

    This is a code sample from Bellini WordPress theme. We used hooks to column class.

    add_action( 'woocommerce_before_shop_loop_item','bellini_before_woo_product_archive_item_one',1 );
    if ( ! function_exists( 'bellini_before_woo_product_archive_item_one' ) ):
    	function bellini_before_woo_product_archive_item_one() {
                    <div class="product--l1 col-sm-4">
    		<div class="product-card__inner">


    We add products from back-end of WP and select column, 2,3,5 e.g. On front end woocommerce add class ( columns-[int column which I selected from back-end]. Now I want to get that class in my content-product.php(In my theme template file of WooCommerce). Please look at the snap shots.

    WordPress Back-end
    Step 1 - WP Admin

    Front-end Inspect Element
    Step 2 - Inspect Element

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to get Column class in template’ is closed to new replies.