Astra_Woocommerce::get_grid_column_count( string $type = 'archive', string $device = 'desktop', int $default = 2 )

Get grid columns for either Archive|Single product.


Description

Introducing this function to reduce lot of CSS we write for ‘grid-template-columns’ for every count (till 6).


Parameters

$type

(string) (Optional) - WooCommerce page type Archive/Single.

Default value: 'archive'

$device

(string) (Optional) - Device specific grid option.

Default value: 'desktop'

$default

(int) (Optional) - Default grid count (fallback basically).

Default value: 2


Return

(int) grid count.


Source

File: inc/compatibility/woocommerce/class-astra-woocommerce.php

		public function get_grid_column_count( $type = 'archive', $device = 'desktop', $default = 2 ) {

			if ( 'archive' === $type ) {
				$products_grid = astra_get_option( 'shop-grids' );
			} else {
				$products_grid = astra_get_option( 'single-product-related-upsell-grid' );
			}

			return isset( $products_grid[ $device ] ) ? absint( $products_grid[ $device ] ) : $default;
		}

Changelog

Changelog
Version Description
3.4.3 Introduced.


User Contributed Notes

You must log in before being able to contribute a note or feedback.