Astra_Woocommerce::add_styles()
Enqueue styles
Description
Source
File: inc/compatibility/woocommerce/class-astra-woocommerce.php
public function add_styles() { /** * - Variable Declaration */ $is_site_rtl = is_rtl(); $theme_color = astra_get_option( 'theme-color' ); $link_color = astra_get_option( 'link-color', $theme_color ); $text_color = astra_get_option( 'text-color' ); $link_h_color = astra_get_option( 'link-h-color' ); $btn_color = astra_get_option( 'button-color' ); if ( empty( $btn_color ) ) { $btn_color = astra_get_foreground_color( $theme_color ); } $btn_h_color = astra_get_option( 'button-h-color' ); if ( empty( $btn_h_color ) ) { $btn_h_color = astra_get_foreground_color( $link_h_color ); } $btn_bg_color = astra_get_option( 'button-bg-color', '', $theme_color ); $btn_bg_h_color = astra_get_option( 'button-bg-h-color', '', $link_h_color ); $btn_border_radius = astra_get_option( 'button-radius' ); $theme_btn_padding = astra_get_option( 'theme-button-padding' ); $cart_h_color = astra_get_foreground_color( $link_h_color ); $site_content_width = astra_get_option( 'site-content-width', 1200 ); $woo_shop_archive_width = astra_get_option( 'shop-archive-width' ); $woo_shop_archive_max_width = astra_get_option( 'shop-archive-max-width' ); // global button border settings. $global_custom_button_border_size = astra_get_option( 'theme-button-border-group-border-size' ); $btn_border_color = astra_get_option( 'theme-button-border-group-border-color' ); $btn_border_h_color = astra_get_option( 'theme-button-border-group-border-h-color' ); $css_output = array( '.woocommerce span.onsale, .wc-block-grid__product .wc-block-grid__product-onsale' => array( 'background-color' => $theme_color, 'color' => astra_get_foreground_color( $theme_color ), ), '.woocommerce a.button, .woocommerce button.button, .woocommerce .woocommerce-message a.button, .woocommerce #respond input#submit.alt, .woocommerce a.button.alt, .woocommerce button.button.alt, .woocommerce input.button.alt, .woocommerce input.button,.woocommerce input.button:disabled, .woocommerce input.button:disabled[disabled], .woocommerce input.button:disabled:hover, .woocommerce input.button:disabled[disabled]:hover, .woocommerce #respond input#submit, .woocommerce button.button.alt.disabled, .wc-block-grid__products .wc-block-grid__product .wp-block-button__link, .wc-block-grid__product-onsale' => array( 'color' => $btn_color, 'border-color' => $btn_bg_color, 'background-color' => $btn_bg_color, ), '.woocommerce a.button:hover, .woocommerce button.button:hover, .woocommerce .woocommerce-message a.button:hover,.woocommerce #respond input#submit:hover,.woocommerce #respond input#submit.alt:hover, .woocommerce a.button.alt:hover, .woocommerce button.button.alt:hover, .woocommerce input.button.alt:hover, .woocommerce input.button:hover, .woocommerce button.button.alt.disabled:hover, .wc-block-grid__products .wc-block-grid__product .wp-block-button__link:hover' => array( 'color' => $btn_h_color, 'border-color' => $btn_bg_h_color, 'background-color' => $btn_bg_h_color, ), '.woocommerce-message, .woocommerce-info' => array( 'border-top-color' => $link_color, ), '.woocommerce-message::before,.woocommerce-info::before' => array( 'color' => $link_color, ), '.woocommerce ul.products li.product .price, .woocommerce div.product p.price, .woocommerce div.product span.price, .widget_layered_nav_filters ul li.chosen a, .woocommerce-page ul.products li.product .ast-woo-product-category, .wc-layered-nav-rating a' => array( 'color' => $text_color, ), // Form Fields, Pagination border Color. '.woocommerce nav.woocommerce-pagination ul,.woocommerce nav.woocommerce-pagination ul li' => array( 'border-color' => $link_color, ), '.woocommerce nav.woocommerce-pagination ul li a:focus, .woocommerce nav.woocommerce-pagination ul li a:hover, .woocommerce nav.woocommerce-pagination ul li span.current' => array( 'background' => $link_color, 'color' => $btn_color, ), '.woocommerce-MyAccount-navigation-link.is-active a' => array( 'color' => $link_h_color, ), '.woocommerce .widget_price_filter .ui-slider .ui-slider-range, .woocommerce .widget_price_filter .ui-slider .ui-slider-handle' => array( 'background-color' => $link_color, ), // Button Typography. '.woocommerce a.button, .woocommerce button.button, .woocommerce .woocommerce-message a.button, .woocommerce #respond input#submit.alt, .woocommerce a.button.alt, .woocommerce button.button.alt, .woocommerce input.button.alt, .woocommerce input.button,.woocommerce-cart table.cart td.actions .button, .woocommerce form.checkout_coupon .button, .woocommerce #respond input#submit, .wc-block-grid__products .wc-block-grid__product .wp-block-button__link' => array( 'border-radius' => astra_get_css_value( $btn_border_radius, 'px' ), 'padding-top' => astra_responsive_spacing( $theme_btn_padding, 'top', 'desktop' ), 'padding-right' => astra_responsive_spacing( $theme_btn_padding, 'right', 'desktop' ), 'padding-bottom' => astra_responsive_spacing( $theme_btn_padding, 'bottom', 'desktop' ), 'padding-left' => astra_responsive_spacing( $theme_btn_padding, 'left', 'desktop' ), ), '.woocommerce .star-rating, .woocommerce .comment-form-rating .stars a, .woocommerce .star-rating::before' => array( 'color' => $link_color, ), '.woocommerce div.product .woocommerce-tabs ul.tabs li.active:before' => array( 'background' => $link_color, ), '.woocommerce a.remove:hover' => array( 'color' => esc_attr( $link_color ), 'border-color' => esc_attr( $link_color ), 'background-color' => esc_attr( '#ffffff' ), ), ); if ( false === Astra_Builder_Helper::$is_header_footer_builder_active ) { $compat_css_desktop = array( /** * Cart in menu */ '.ast-site-header-cart a' => array( 'color' => esc_attr( $text_color ), ), '.ast-site-header-cart a:focus, .ast-site-header-cart a:hover, .ast-site-header-cart .current-menu-item a' => array( 'color' => esc_attr( $link_color ), ), '.ast-cart-menu-wrap .count, .ast-cart-menu-wrap .count:after' => array( 'border-color' => esc_attr( $link_color ), 'color' => esc_attr( $link_color ), ), '.ast-cart-menu-wrap:hover .count' => array( 'color' => esc_attr( $cart_h_color ), 'background-color' => esc_attr( $link_color ), ), '.ast-site-header-cart .widget_shopping_cart .total .woocommerce-Price-amount' => array( 'color' => esc_attr( $link_color ), ), '.woocommerce a.remove:hover, .ast-woocommerce-cart-menu .main-header-menu .woocommerce-custom-menu-item .menu-item:hover > .menu-link.remove:hover' => array( 'color' => esc_attr( $link_color ), 'border-color' => esc_attr( $link_color ), 'background-color' => esc_attr( '#ffffff' ), ), /** * Checkout button color for widget */ '.ast-site-header-cart .widget_shopping_cart .buttons .button.checkout, .woocommerce .widget_shopping_cart .woocommerce-mini-cart__buttons .checkout.wc-forward' => array( 'color' => $btn_h_color, 'border-color' => $btn_bg_h_color, 'background-color' => $btn_bg_h_color, ), '.site-header .ast-site-header-cart-data .button.wc-forward, .site-header .ast-site-header-cart-data .button.wc-forward:hover' => array( 'color' => $btn_color, ), '.below-header-user-select .ast-site-header-cart .widget, .ast-above-header-section .ast-site-header-cart .widget a, .below-header-user-select .ast-site-header-cart .widget_shopping_cart a' => array( 'color' => $text_color, ), '.below-header-user-select .ast-site-header-cart .widget_shopping_cart a:hover, .ast-above-header-section .ast-site-header-cart .widget_shopping_cart a:hover, .below-header-user-select .ast-site-header-cart .widget_shopping_cart a.remove:hover, .ast-above-header-section .ast-site-header-cart .widget_shopping_cart a.remove:hover' => array( 'color' => esc_attr( $link_color ), ), ); $css_output = array_merge( $css_output, $compat_css_desktop ); } if ( Astra_Builder_Helper::apply_flex_based_css() ) { $css_output['.woocommerce[class*="rel-up-columns-"] .site-main div.product .related.products ul.products li.product, .woocommerce-page .site-main ul.products li.product'] = array( 'width' => '100%', ); } if ( false === Astra_Icons::is_svg_icons() ) { $css_output['.woocommerce ul.product-categories > li ul li:before'] = array( 'content' => '"\e900"', 'padding' => '0 5px 0 5px', 'display' => 'inline-block', 'font-family' => 'Astra', 'transform' => 'rotate(-90deg)', 'font-size' => '11px', 'font-size' => '0.7rem', ); } else { $css_output['.woocommerce ul.product-categories > li ul li'] = array( 'position' => 'relative', ); if ( $is_site_rtl ) { $css_output['.woocommerce ul.product-categories > li ul li:before'] = array( 'content' => '""', 'border-width' => '1px 0 0 1px', 'border-style' => 'solid', 'display' => 'inline-block', 'width' => '6px', 'height' => '6px', 'position' => 'absolute', 'top' => '50%', 'margin-top' => '-2px', '-webkit-transform' => 'rotate(45deg)', 'transform' => 'rotate(45deg)', ); $css_output['.woocommerce ul.product-categories > li ul li a'] = array( 'margin-right' => '15px', ); } else { $css_output['.woocommerce ul.product-categories > li ul li:before'] = array( 'content' => '""', 'border-width' => '1px 1px 0 0', 'border-style' => 'solid', 'display' => 'inline-block', 'width' => '6px', 'height' => '6px', 'position' => 'absolute', 'top' => '50%', 'margin-top' => '-2px', '-webkit-transform' => 'rotate(45deg)', 'transform' => 'rotate(45deg)', ); $css_output['.woocommerce ul.product-categories > li ul li a'] = array( 'margin-left' => '15px', ); } } /* Parse WooCommerce General CSS from array() */ $css_output = astra_parse_css( $css_output ); if ( ! Astra_Builder_Helper::apply_flex_based_css() ) { $tablet_css_shop_page_grid = array( '.woocommerce.tablet-columns-6 ul.products li.product, .woocommerce-page.tablet-columns-6 ul.products li.product' => array( 'width' => '12.7%', 'width' => 'calc(16.66% - 16.66px)', ), '.woocommerce.tablet-columns-5 ul.products li.product, .woocommerce-page.tablet-columns-5 ul.products li.product' => array( 'width' => '16.2%', 'width' => 'calc(20% - 16px)', ), '.woocommerce.tablet-columns-4 ul.products li.product, .woocommerce-page.tablet-columns-4 ul.products li.product' => array( 'width' => '21.5%', 'width' => 'calc(25% - 15px)', ), '.woocommerce.tablet-columns-3 ul.products li.product, .woocommerce-page.tablet-columns-3 ul.products li.product' => array( 'width' => '30.2%', 'width' => 'calc(33.33% - 14px)', ), '.woocommerce.tablet-columns-2 ul.products li.product, .woocommerce-page.tablet-columns-2 ul.products li.product' => array( 'width' => '47.6%', 'width' => 'calc(50% - 10px)', ), '.woocommerce.tablet-columns-1 ul.products li.product, .woocommerce-page.tablet-columns-1 ul.products li.product' => array( 'width' => '100%', ), '.woocommerce div.product .related.products ul.products li.product' => array( 'width' => '30.2%', 'width' => 'calc(33.33% - 14px)', ), ); } else { $archive_tablet_grid = $this->get_grid_column_count( 'archive', 'tablet' ); $tablet_css_shop_page_grid = array( '.woocommerce.tablet-columns-' . $archive_tablet_grid . ' ul.products li.product, .woocommerce-page.tablet-columns-' . $archive_tablet_grid . ' ul.products' => array( 'grid-template-columns' => 'repeat(' . $archive_tablet_grid . ', minmax(0, 1fr))', ), ); } $css_output .= astra_parse_css( $tablet_css_shop_page_grid, astra_get_mobile_breakpoint( '', 1 ), astra_get_tablet_breakpoint() ); if ( ! Astra_Builder_Helper::apply_flex_based_css() ) { if ( $is_site_rtl ) { $tablet_shop_page_grid_lang_direction_css = array( '.woocommerce[class*="columns-"].columns-3 > ul.products li.product, .woocommerce[class*="columns-"].columns-4 > ul.products li.product, .woocommerce[class*="columns-"].columns-5 > ul.products li.product, .woocommerce[class*="columns-"].columns-6 > ul.products li.product' => array( 'width' => '30.2%', 'width' => 'calc(33.33% - 14px)', 'margin-left' => '20px', ), '.woocommerce[class*="columns-"].columns-3 > ul.products li.product:nth-child(3n), .woocommerce[class*="columns-"].columns-4 > ul.products li.product:nth-child(3n), .woocommerce[class*="columns-"].columns-5 > ul.products li.product:nth-child(3n), .woocommerce[class*="columns-"].columns-6 > ul.products li.product:nth-child(3n)' => array( 'margin-left' => 0, 'clear' => 'left', ), '.woocommerce[class*="columns-"].columns-3 > ul.products li.product:nth-child(3n+1), .woocommerce[class*="columns-"].columns-4 > ul.products li.product:nth-child(3n+1), .woocommerce[class*="columns-"].columns-5 > ul.products li.product:nth-child(3n+1), .woocommerce[class*="columns-"].columns-6 > ul.products li.product:nth-child(3n+1)' => array( 'clear' => 'right', ), '.woocommerce[class*="columns-"] ul.products li.product:nth-child(n), .woocommerce-page[class*="columns-"] ul.products li.product:nth-child(n)' => array( 'margin-left' => '20px', 'clear' => 'none', ), '.woocommerce.tablet-columns-2 ul.products li.product:nth-child(2n), .woocommerce-page.tablet-columns-2 ul.products li.product:nth-child(2n), .woocommerce.tablet-columns-3 ul.products li.product:nth-child(3n), .woocommerce-page.tablet-columns-3 ul.products li.product:nth-child(3n), .woocommerce.tablet-columns-4 ul.products li.product:nth-child(4n), .woocommerce-page.tablet-columns-4 ul.products li.product:nth-child(4n), .woocommerce.tablet-columns-5 ul.products li.product:nth-child(5n), .woocommerce-page.tablet-columns-5 ul.products li.product:nth-child(5n), .woocommerce.tablet-columns-6 ul.products li.product:nth-child(6n), .woocommerce-page.tablet-columns-6 ul.products li.product:nth-child(6n)' => array( 'margin-left' => '0', 'clear' => 'left', ), '.woocommerce.tablet-columns-2 ul.products li.product:nth-child(2n+1), .woocommerce-page.tablet-columns-2 ul.products li.product:nth-child(2n+1), .woocommerce.tablet-columns-3 ul.products li.product:nth-child(3n+1), .woocommerce-page.tablet-columns-3 ul.products li.product:nth-child(3n+1), .woocommerce.tablet-columns-4 ul.products li.product:nth-child(4n+1), .woocommerce-page.tablet-columns-4 ul.products li.product:nth-child(4n+1), .woocommerce.tablet-columns-5 ul.products li.product:nth-child(5n+1), .woocommerce-page.tablet-columns-5 ul.products li.product:nth-child(5n+1), .woocommerce.tablet-columns-6 ul.products li.product:nth-child(6n+1), .woocommerce-page.tablet-columns-6 ul.products li.product:nth-child(6n+1)' => array( 'clear' => 'right', ), '.woocommerce div.product .related.products ul.products li.product:nth-child(3n), .woocommerce-page.tablet-columns-1 .site-main ul.products li.product' => array( 'margin-left' => 0, 'clear' => 'left', ), '.woocommerce div.product .related.products ul.products li.product:nth-child(3n+1)' => array( 'clear' => 'right', ), ); } else { $tablet_shop_page_grid_lang_direction_css = array( '.woocommerce[class*="columns-"].columns-3 > ul.products li.product, .woocommerce[class*="columns-"].columns-4 > ul.products li.product, .woocommerce[class*="columns-"].columns-5 > ul.products li.product, .woocommerce[class*="columns-"].columns-6 > ul.products li.product' => array( 'width' => '30.2%', 'width' => 'calc(33.33% - 14px)', 'margin-right' => '20px', ), '.woocommerce[class*="columns-"].columns-3 > ul.products li.product:nth-child(3n), .woocommerce[class*="columns-"].columns-4 > ul.products li.product:nth-child(3n), .woocommerce[class*="columns-"].columns-5 > ul.products li.product:nth-child(3n), .woocommerce[class*="columns-"].columns-6 > ul.products li.product:nth-child(3n)' => array( 'margin-right' => 0, 'clear' => 'right', ), '.woocommerce[class*="columns-"].columns-3 > ul.products li.product:nth-child(3n+1), .woocommerce[class*="columns-"].columns-4 > ul.products li.product:nth-child(3n+1), .woocommerce[class*="columns-"].columns-5 > ul.products li.product:nth-child(3n+1), .woocommerce[class*="columns-"].columns-6 > ul.products li.product:nth-child(3n+1)' => array( 'clear' => 'left', ), '.woocommerce[class*="columns-"] ul.products li.product:nth-child(n), .woocommerce-page[class*="columns-"] ul.products li.product:nth-child(n)' => array( 'margin-right' => '20px', 'clear' => 'none', ), '.woocommerce.tablet-columns-2 ul.products li.product:nth-child(2n), .woocommerce-page.tablet-columns-2 ul.products li.product:nth-child(2n), .woocommerce.tablet-columns-3 ul.products li.product:nth-child(3n), .woocommerce-page.tablet-columns-3 ul.products li.product:nth-child(3n), .woocommerce.tablet-columns-4 ul.products li.product:nth-child(4n), .woocommerce-page.tablet-columns-4 ul.products li.product:nth-child(4n), .woocommerce.tablet-columns-5 ul.products li.product:nth-child(5n), .woocommerce-page.tablet-columns-5 ul.products li.product:nth-child(5n), .woocommerce.tablet-columns-6 ul.products li.product:nth-child(6n), .woocommerce-page.tablet-columns-6 ul.products li.product:nth-child(6n)' => array( 'margin-right' => '0', 'clear' => 'right', ), '.woocommerce.tablet-columns-2 ul.products li.product:nth-child(2n+1), .woocommerce-page.tablet-columns-2 ul.products li.product:nth-child(2n+1), .woocommerce.tablet-columns-3 ul.products li.product:nth-child(3n+1), .woocommerce-page.tablet-columns-3 ul.products li.product:nth-child(3n+1), .woocommerce.tablet-columns-4 ul.products li.product:nth-child(4n+1), .woocommerce-page.tablet-columns-4 ul.products li.product:nth-child(4n+1), .woocommerce.tablet-columns-5 ul.products li.product:nth-child(5n+1), .woocommerce-page.tablet-columns-5 ul.products li.product:nth-child(5n+1), .woocommerce.tablet-columns-6 ul.products li.product:nth-child(6n+1), .woocommerce-page.tablet-columns-6 ul.products li.product:nth-child(6n+1)' => array( 'clear' => 'left', ), '.woocommerce div.product .related.products ul.products li.product:nth-child(3n), .woocommerce-page.tablet-columns-1 .site-main ul.products li.product' => array( 'margin-right' => 0, 'clear' => 'right', ), '.woocommerce div.product .related.products ul.products li.product:nth-child(3n+1)' => array( 'clear' => 'left', ), ); } $css_output .= astra_parse_css( $tablet_shop_page_grid_lang_direction_css, astra_get_mobile_breakpoint( '', 1 ), astra_get_tablet_breakpoint() ); } /** * Global button CSS - Tablet = min-wdth: (tablet + 1)px */ if ( $is_site_rtl ) { $min_tablet_css = array( '.woocommerce #reviews #comments' => array( 'width' => '55%', 'float' => 'right', ), '.woocommerce #reviews #review_form_wrapper' => array( 'width' => '45%', 'float' => 'left', 'padding-right' => '2em', ), '.woocommerce form.checkout_coupon' => array( 'width' => '50%', ), ); if ( ! Astra_Builder_Helper::apply_flex_based_css() ) { $min_tablet_css['.woocommerce #reviews #comments']['float'] = 'right'; $min_tablet_css['.woocommerce #reviews #review_form_wrapper']['float'] = 'left'; } } else { $min_tablet_css = array( '.woocommerce #reviews #comments' => array( 'width' => '55%', ), '.woocommerce #reviews #review_form_wrapper' => array( 'width' => '45%', 'padding-left' => '2em', ), '.woocommerce form.checkout_coupon' => array( 'width' => '50%', ), ); if ( ! Astra_Builder_Helper::apply_flex_based_css() ) { $min_tablet_css['.woocommerce #reviews #comments']['float'] = 'left'; $min_tablet_css['.woocommerce #reviews #review_form_wrapper']['float'] = 'right'; } } $css_output .= astra_parse_css( $min_tablet_css, astra_get_tablet_breakpoint( '', 1 ) ); /** * Global button CSS - Tablet = max-width: (tab-breakpoint)px. */ $css_global_button_tablet = array( '.ast-header-break-point.ast-woocommerce-cart-menu .header-main-layout-1.ast-mobile-header-stack.ast-no-menu-items .ast-site-header-cart, .ast-header-break-point.ast-woocommerce-cart-menu .header-main-layout-3.ast-mobile-header-stack.ast-no-menu-items .ast-site-header-cart' => array( 'padding-right' => 0, 'padding-left' => 0, ), '.ast-header-break-point.ast-woocommerce-cart-menu .header-main-layout-1.ast-mobile-header-stack .main-header-bar' => array( 'text-align' => 'center', ), '.ast-header-break-point.ast-woocommerce-cart-menu .header-main-layout-1.ast-mobile-header-stack .ast-site-header-cart, .ast-header-break-point.ast-woocommerce-cart-menu .header-main-layout-1.ast-mobile-header-stack .ast-mobile-menu-buttons' => array( 'display' => 'inline-block', ), '.ast-header-break-point.ast-woocommerce-cart-menu .header-main-layout-2.ast-mobile-header-inline .site-branding' => array( 'flex' => 'auto', ), '.ast-header-break-point.ast-woocommerce-cart-menu .header-main-layout-3.ast-mobile-header-stack .site-branding' => array( 'flex' => '0 0 100%', ), '.ast-header-break-point.ast-woocommerce-cart-menu .header-main-layout-3.ast-mobile-header-stack .main-header-container' => array( 'display' => 'flex', 'justify-content' => 'center', ), '.woocommerce-cart .woocommerce-shipping-calculator .button' => array( 'width' => '100%', ), '.woocommerce a.button, .woocommerce button.button, .woocommerce .woocommerce-message a.button, .woocommerce #respond input#submit.alt, .woocommerce a.button.alt, .woocommerce button.button.alt, .woocommerce input.button.alt, .woocommerce input.button,.woocommerce-cart table.cart td.actions .button, .woocommerce form.checkout_coupon .button, .woocommerce #respond input#submit, .wc-block-grid__products .wc-block-grid__product .wp-block-button__link' => array( 'padding-top' => astra_responsive_spacing( $theme_btn_padding, 'top', 'tablet' ), 'padding-right' => astra_responsive_spacing( $theme_btn_padding, 'right', 'tablet' ), 'padding-bottom' => astra_responsive_spacing( $theme_btn_padding, 'bottom', 'tablet' ), 'padding-left' => astra_responsive_spacing( $theme_btn_padding, 'left', 'tablet' ), ), '.woocommerce div.product div.images, .woocommerce div.product div.summary, .woocommerce #content div.product div.images, .woocommerce #content div.product div.summary, .woocommerce-page div.product div.images, .woocommerce-page div.product div.summary, .woocommerce-page #content div.product div.images, .woocommerce-page #content div.product div.summary' => array( 'float' => 'none', 'width' => '100%', ), '.woocommerce-cart table.cart td.actions .ast-return-to-shop' => array( 'display' => 'block', 'text-align' => 'center', 'margin-top' => '1em', ), ); if ( Astra_Builder_Helper::apply_flex_based_css() ) { $css_global_button_tablet['.woocommerce ul.products, .woocommerce-page ul.products'] = array( 'grid-template-columns' => 'repeat(3, minmax(0, 1fr))', ); if ( is_shop() || is_product_taxonomy() ) { $archive_tablet_grid = $this->get_grid_column_count( 'archive', 'tablet' ); $css_global_button_tablet[ '.woocommerce.tablet-columns-' . $archive_tablet_grid . ' ul.products' ] = array( 'grid-template-columns' => 'repeat(' . $archive_tablet_grid . ', minmax(0, 1fr))', ); $css_global_button_tablet['.woocommerce[class*="tablet-columns-"] .site-main div.product .related.products ul.products li.product'] = array( 'width' => '100%', ); } if ( is_product() ) { $single_tablet_grid = $this->get_grid_column_count( 'single', 'tablet' ); $css_global_button_tablet[ '.woocommerce.tablet-rel-up-columns-' . $single_tablet_grid . ' ul.products' ] = array( 'grid-template-columns' => 'repeat(' . $single_tablet_grid . ', minmax(0, 1fr))', ); $css_global_button_tablet['.woocommerce[class*="tablet-rel-up-columns-"] .site-main div.product .related.products ul.products li.product'] = array( 'width' => '100%', ); } } $css_output .= astra_parse_css( $css_global_button_tablet, '', astra_get_tablet_breakpoint() ); /** * Global button CSS - Mobile = max-width: (mobile-breakpoint)px. */ $css_global_button_mobile = array( '.ast-separate-container .ast-woocommerce-container' => array( 'padding' => '.54em 1em 1.33333em', ), '.woocommerce a.button, .woocommerce button.button, .woocommerce .woocommerce-message a.button, .woocommerce #respond input#submit.alt, .woocommerce a.button.alt, .woocommerce button.button.alt, .woocommerce input.button.alt, .woocommerce input.button,.woocommerce-cart table.cart td.actions .button, .woocommerce form.checkout_coupon .button, .woocommerce #respond input#submit, .wc-block-grid__products .wc-block-grid__product .wp-block-button__link' => array( 'padding-top' => astra_responsive_spacing( $theme_btn_padding, 'top', 'mobile' ), 'padding-right' => astra_responsive_spacing( $theme_btn_padding, 'right', 'mobile' ), 'padding-bottom' => astra_responsive_spacing( $theme_btn_padding, 'bottom', 'mobile' ), 'padding-left' => astra_responsive_spacing( $theme_btn_padding, 'left', 'mobile' ), ), '.woocommerce-message, .woocommerce-error, .woocommerce-info' => array( 'display' => 'flex', 'flex-wrap' => 'wrap', ), '.woocommerce-message a.button, .woocommerce-error a.button, .woocommerce-info a.button' => array( 'order' => '1', 'margin-top' => '.5em', ), '.woocommerce .woocommerce-ordering, .woocommerce-page .woocommerce-ordering' => array( 'float' => 'none', 'margin-bottom' => '2em', 'width' => '100%', ), '.woocommerce ul.products a.button, .woocommerce-page ul.products a.button' => array( 'padding' => '0.5em 0.75em', ), '.woocommerce table.cart td.actions .button, .woocommerce #content table.cart td.actions .button, .woocommerce-page table.cart td.actions .button, .woocommerce-page #content table.cart td.actions .button' => array( 'padding-left' => '1em', 'padding-right' => '1em', ), '.woocommerce #content table.cart .button, .woocommerce-page #content table.cart .button' => array( 'width' => '100%', ), '.woocommerce #content table.cart .product-thumbnail, .woocommerce-page #content table.cart .product-thumbnail' => array( 'display' => 'block', 'text-align' => 'center !important', ), '.woocommerce #content table.cart .product-thumbnail::before, .woocommerce-page #content table.cart .product-thumbnail::before' => array( 'display' => 'none', ), '.woocommerce #content table.cart td.actions .coupon, .woocommerce-page #content table.cart td.actions .coupon' => array( 'float' => 'none', ), '.woocommerce #content table.cart td.actions .coupon .button, .woocommerce-page #content table.cart td.actions .coupon .button' => array( 'flex' => '1', ), '.woocommerce #content div.product .woocommerce-tabs ul.tabs li a, .woocommerce-page #content div.product .woocommerce-tabs ul.tabs li a' => array( 'display' => 'block', ), ); if ( ! Astra_Builder_Helper::apply_flex_based_css() ) { $css_global_button_mobile['.woocommerce div.product .related.products ul.products li.product, .woocommerce.mobile-columns-2 ul.products li.product, .woocommerce-page.mobile-columns-2 ul.products li.product'] = array( 'width' => '46.1%', 'width' => 'calc(50% - 10px)', ); $css_global_button_mobile['.woocommerce.mobile-columns-6 ul.products li.product, .woocommerce-page.mobile-columns-6 ul.products li.product'] = array( 'width' => '10.2%', 'width' => 'calc(16.66% - 16.66px)', ); $css_global_button_mobile['.woocommerce.mobile-columns-5 ul.products li.product, .woocommerce-page.mobile-columns-5 ul.products li.product'] = array( 'width' => '13%', 'width' => 'calc(20% - 16px)', ); $css_global_button_mobile['.woocommerce.mobile-columns-4 ul.products li.product, .woocommerce-page.mobile-columns-4 ul.products li.product'] = array( 'width' => '19%', 'width' => 'calc(25% - 15px)', ); $css_global_button_mobile['.woocommerce.mobile-columns-3 ul.products li.product, .woocommerce-page.mobile-columns-3 ul.products li.product'] = array( 'width' => '28.2%', 'width' => 'calc(33.33% - 14px)', ); $css_global_button_mobile['.woocommerce.mobile-columns-1 ul.products li.product, .woocommerce-page.mobile-columns-1 ul.products li.product'] = array( 'width' => '100%', ); } else { $archive_mobile_grid = $this->get_grid_column_count( 'archive', 'mobile' ); $single_mobile_grid = $this->get_grid_column_count( 'single', 'mobile' ); $css_global_button_mobile[ '.woocommerce ul.products, .woocommerce-page ul.products, .woocommerce.mobile-columns-' . $archive_mobile_grid . ' ul.products, .woocommerce-page.mobile-columns-' . $archive_mobile_grid . ' ul.products' ] = array( 'grid-template-columns' => 'repeat(' . $archive_mobile_grid . ', minmax(0, 1fr))', ); $css_global_button_mobile[ '.woocommerce.mobile-rel-up-columns-' . $single_mobile_grid . ' ul.products' ] = array( 'grid-template-columns' => 'repeat(' . $single_mobile_grid . ', minmax(0, 1fr))', ); } $css_output .= astra_parse_css( $css_global_button_mobile, '', astra_get_mobile_breakpoint() ); if ( $is_site_rtl ) { $global_button_mobile_lang_direction_css = array( '.woocommerce[class*="columns-"].columns-3 > ul.products li.product, .woocommerce[class*="columns-"].columns-4 > ul.products li.product, .woocommerce[class*="columns-"].columns-5 > ul.products li.product, .woocommerce[class*="columns-"].columns-6 > ul.products li.product' => array( 'width' => '46.1%', 'width' => 'calc(50% - 10px)', 'margin-left' => '20px', ), '.woocommerce ul.products a.button.loading::after, .woocommerce-page ul.products a.button.loading::after' => array( 'display' => 'inline-block', 'margin-right' => '5px', 'position' => 'initial', ), '.woocommerce.mobile-columns-1 .site-main ul.products li.product:nth-child(n), .woocommerce-page.mobile-columns-1 .site-main ul.products li.product:nth-child(n)' => array( 'margin-left' => 0, ), '.woocommerce #content div.product .woocommerce-tabs ul.tabs li, .woocommerce-page #content div.product .woocommerce-tabs ul.tabs li' => array( 'display' => 'block', 'margin-left' => 0, ), ); if ( ! Astra_Builder_Helper::apply_flex_based_css() ) { $global_button_mobile_lang_direction_css['.woocommerce[class*="columns-"] ul.products li.product:nth-child(n), .woocommerce-page[class*="columns-"] ul.products li.product:nth-child(n)'] = array( 'margin-left' => '20px', 'clear' => 'none', ); $global_button_mobile_lang_direction_css['.woocommerce-page[class*=columns-].columns-3>ul.products li.product:nth-child(2n), .woocommerce-page[class*=columns-].columns-4>ul.products li.product:nth-child(2n), .woocommerce-page[class*=columns-].columns-5>ul.products li.product:nth-child(2n), .woocommerce-page[class*=columns-].columns-6>ul.products li.product:nth-child(2n), .woocommerce[class*=columns-].columns-3>ul.products li.product:nth-child(2n), .woocommerce[class*=columns-].columns-4>ul.products li.product:nth-child(2n), .woocommerce[class*=columns-].columns-5>ul.products li.product:nth-child(2n), .woocommerce[class*=columns-].columns-6>ul.products li.product:nth-child(2n)'] = array( 'margin-left' => 0, 'clear' => 'left', ); $global_button_mobile_lang_direction_css['.woocommerce[class*="columns-"].columns-3 > ul.products li.product:nth-child(2n+1), .woocommerce[class*="columns-"].columns-4 > ul.products li.product:nth-child(2n+1), .woocommerce[class*="columns-"].columns-5 > ul.products li.product:nth-child(2n+1), .woocommerce[class*="columns-"].columns-6 > ul.products li.product:nth-child(2n+1)'] = array( 'clear' => 'right', ); $global_button_mobile_lang_direction_css['.woocommerce-page[class*=columns-] ul.products li.product:nth-child(n), .woocommerce[class*=columns-] ul.products li.product:nth-child(n)'] = array( 'margin-left' => '20px', 'clear' => 'none', ); $global_button_mobile_lang_direction_css['.woocommerce.mobile-columns-6 ul.products li.product:nth-child(6n), .woocommerce-page.mobile-columns-6 ul.products li.product:nth-child(6n), .woocommerce.mobile-columns-5 ul.products li.product:nth-child(5n), .woocommerce-page.mobile-columns-5 ul.products li.product:nth-child(5n), .woocommerce.mobile-columns-4 ul.products li.product:nth-child(4n), .woocommerce-page.mobile-columns-4 ul.products li.product:nth-child(4n), .woocommerce.mobile-columns-3 ul.products li.product:nth-child(3n), .woocommerce-page.mobile-columns-3 ul.products li.product:nth-child(3n), .woocommerce.mobile-columns-2 ul.products li.product:nth-child(2n), .woocommerce-page.mobile-columns-2 ul.products li.product:nth-child(2n), .woocommerce div.product .related.products ul.products li.product:nth-child(2n)'] = array( 'margin-left' => 0, 'clear' => 'left', ); $global_button_mobile_lang_direction_css['.woocommerce.mobile-columns-6 ul.products li.product:nth-child(6n+1), .woocommerce-page.mobile-columns-6 ul.products li.product:nth-child(6n+1), .woocommerce.mobile-columns-5 ul.products li.product:nth-child(5n+1), .woocommerce-page.mobile-columns-5 ul.products li.product:nth-child(5n+1), .woocommerce.mobile-columns-4 ul.products li.product:nth-child(4n+1), .woocommerce-page.mobile-columns-4 ul.products li.product:nth-child(4n+1), .woocommerce.mobile-columns-3 ul.products li.product:nth-child(3n+1), .woocommerce-page.mobile-columns-3 ul.products li.product:nth-child(3n+1), .woocommerce.mobile-columns-2 ul.products li.product:nth-child(2n+1), .woocommerce-page.mobile-columns-2 ul.products li.product:nth-child(2n+1), .woocommerce div.product .related.products ul.products li.product:nth-child(2n+1)'] = array( 'clear' => 'right', ); } } else { $global_button_mobile_lang_direction_css = array( '.woocommerce[class*="columns-"].columns-3 > ul.products li.product, .woocommerce[class*="columns-"].columns-4 > ul.products li.product, .woocommerce[class*="columns-"].columns-5 > ul.products li.product, .woocommerce[class*="columns-"].columns-6 > ul.products li.product' => array( 'width' => '46.1%', 'width' => 'calc(50% - 10px)', 'margin-right' => '20px', ), '.woocommerce ul.products a.button.loading::after, .woocommerce-page ul.products a.button.loading::after' => array( 'display' => 'inline-block', 'margin-left' => '5px', 'position' => 'initial', ), '.woocommerce.mobile-columns-1 .site-main ul.products li.product:nth-child(n), .woocommerce-page.mobile-columns-1 .site-main ul.products li.product:nth-child(n)' => array( 'margin-right' => 0, ), '.woocommerce #content div.product .woocommerce-tabs ul.tabs li, .woocommerce-page #content div.product .woocommerce-tabs ul.tabs li' => array( 'display' => 'block', 'margin-right' => 0, ), ); if ( ! Astra_Builder_Helper::apply_flex_based_css() ) { $global_button_mobile_lang_direction_css['.woocommerce[class*="columns-"] ul.products li.product:nth-child(n), .woocommerce-page[class*="columns-"] ul.products li.product:nth-child(n)'] = array( 'margin-right' => '20px', 'clear' => 'none', ); $global_button_mobile_lang_direction_css['.woocommerce-page[class*=columns-].columns-3>ul.products li.product:nth-child(2n), .woocommerce-page[class*=columns-].columns-4>ul.products li.product:nth-child(2n), .woocommerce-page[class*=columns-].columns-5>ul.products li.product:nth-child(2n), .woocommerce-page[class*=columns-].columns-6>ul.products li.product:nth-child(2n), .woocommerce[class*=columns-].columns-3>ul.products li.product:nth-child(2n), .woocommerce[class*=columns-].columns-4>ul.products li.product:nth-child(2n), .woocommerce[class*=columns-].columns-5>ul.products li.product:nth-child(2n), .woocommerce[class*=columns-].columns-6>ul.products li.product:nth-child(2n)'] = array( 'margin-right' => 0, 'clear' => 'right', ); $global_button_mobile_lang_direction_css['.woocommerce[class*="columns-"].columns-3 > ul.products li.product:nth-child(2n+1), .woocommerce[class*="columns-"].columns-4 > ul.products li.product:nth-child(2n+1), .woocommerce[class*="columns-"].columns-5 > ul.products li.product:nth-child(2n+1), .woocommerce[class*="columns-"].columns-6 > ul.products li.product:nth-child(2n+1)'] = array( 'clear' => 'left', ); $global_button_mobile_lang_direction_css['.woocommerce-page[class*=columns-] ul.products li.product:nth-child(n), .woocommerce[class*=columns-] ul.products li.product:nth-child(n)'] = array( 'margin-right' => '20px', 'clear' => 'none', ); $global_button_mobile_lang_direction_css['.woocommerce.mobile-columns-6 ul.products li.product:nth-child(6n), .woocommerce-page.mobile-columns-6 ul.products li.product:nth-child(6n), .woocommerce.mobile-columns-5 ul.products li.product:nth-child(5n), .woocommerce-page.mobile-columns-5 ul.products li.product:nth-child(5n), .woocommerce.mobile-columns-4 ul.products li.product:nth-child(4n), .woocommerce-page.mobile-columns-4 ul.products li.product:nth-child(4n), .woocommerce.mobile-columns-3 ul.products li.product:nth-child(3n), .woocommerce-page.mobile-columns-3 ul.products li.product:nth-child(3n), .woocommerce.mobile-columns-2 ul.products li.product:nth-child(2n), .woocommerce-page.mobile-columns-2 ul.products li.product:nth-child(2n), .woocommerce div.product .related.products ul.products li.product:nth-child(2n)'] = array( 'margin-right' => 0, 'clear' => 'right', ); $global_button_mobile_lang_direction_css['.woocommerce.mobile-columns-6 ul.products li.product:nth-child(6n+1), .woocommerce-page.mobile-columns-6 ul.products li.product:nth-child(6n+1), .woocommerce.mobile-columns-5 ul.products li.product:nth-child(5n+1), .woocommerce-page.mobile-columns-5 ul.products li.product:nth-child(5n+1), .woocommerce.mobile-columns-4 ul.products li.product:nth-child(4n+1), .woocommerce-page.mobile-columns-4 ul.products li.product:nth-child(4n+1), .woocommerce.mobile-columns-3 ul.products li.product:nth-child(3n+1), .woocommerce-page.mobile-columns-3 ul.products li.product:nth-child(3n+1), .woocommerce.mobile-columns-2 ul.products li.product:nth-child(2n+1), .woocommerce-page.mobile-columns-2 ul.products li.product:nth-child(2n+1), .woocommerce div.product .related.products ul.products li.product:nth-child(2n+1)'] = array( 'clear' => 'left', ); } } $css_output .= astra_parse_css( $global_button_mobile_lang_direction_css, '', astra_get_mobile_breakpoint() ); if ( 'page-builder' !== astra_get_content_layout() ) { /* Woocommerce Shop Archive width */ if ( 'custom' === $woo_shop_archive_width ) : // Woocommerce shop archive custom width. $site_width = array( '.ast-woo-shop-archive .site-content > .ast-container' => array( 'max-width' => astra_get_css_value( $woo_shop_archive_max_width, 'px' ), ), ); $css_output .= astra_parse_css( $site_width, astra_get_tablet_breakpoint( '', 1 ) ); else : // Woocommerce shop archive default width. $site_width = array( '.ast-woo-shop-archive .site-content > .ast-container' => array( 'max-width' => astra_get_css_value( $site_content_width + 40, 'px' ), ), ); /* Parse CSS from array()*/ $css_output .= astra_parse_css( $site_width, astra_get_tablet_breakpoint( '', 1 ) ); endif; } $woo_product_css = array( '.woocommerce #content .ast-woocommerce-container div.product div.images, .woocommerce .ast-woocommerce-container div.product div.images, .woocommerce-page #content .ast-woocommerce-container div.product div.images, .woocommerce-page .ast-woocommerce-container div.product div.images' => array( 'width' => '50%', ), '.woocommerce #content .ast-woocommerce-container div.product div.summary, .woocommerce .ast-woocommerce-container div.product div.summary, .woocommerce-page #content .ast-woocommerce-container div.product div.summary, .woocommerce-page .ast-woocommerce-container div.product div.summary' => array( 'width' => '46%', ), '.woocommerce.woocommerce-checkout form #customer_details.col2-set .col-1, .woocommerce.woocommerce-checkout form #customer_details.col2-set .col-2, .woocommerce-page.woocommerce-checkout form #customer_details.col2-set .col-1, .woocommerce-page.woocommerce-checkout form #customer_details.col2-set .col-2' => array( 'float' => 'none', 'width' => 'auto', ), ); /* Parse CSS from array()*/ $css_output .= astra_parse_css( $woo_product_css, astra_get_tablet_breakpoint( '', 1 ) ); /* * global button settings not working for woocommerce button on shop and single page. * check if the current user is existing user or new user. * if new user load the CSS bty default if existing provide a filter */ if ( self::astra_global_btn_woo_comp() ) { $woo_global_button_css = array( '.woocommerce a.button , .woocommerce button.button.alt ,.woocommerce-page table.cart td.actions .button, .woocommerce-page #content table.cart td.actions .button , .woocommerce a.button.alt ,.woocommerce .woocommerce-message a.button , .ast-site-header-cart .widget_shopping_cart .buttons .button.checkout, .woocommerce button.button.alt.disabled , .wc-block-grid__products .wc-block-grid__product .wp-block-button__link ' => array( 'border' => 'solid', 'border-top-width' => ( isset( $global_custom_button_border_size['top'] ) && '' !== $global_custom_button_border_size['top'] ) ? astra_get_css_value( $global_custom_button_border_size['top'], 'px' ) : '0', 'border-right-width' => ( isset( $global_custom_button_border_size['right'] ) && '' !== $global_custom_button_border_size['right'] ) ? astra_get_css_value( $global_custom_button_border_size['right'], 'px' ) : '0', 'border-left-width' => ( isset( $global_custom_button_border_size['left'] ) && '' !== $global_custom_button_border_size['left'] ) ? astra_get_css_value( $global_custom_button_border_size['left'], 'px' ) : '0', 'border-bottom-width' => ( isset( $global_custom_button_border_size['bottom'] ) && '' !== $global_custom_button_border_size['bottom'] ) ? astra_get_css_value( $global_custom_button_border_size['bottom'], 'px' ) : '0', 'border-color' => $btn_border_color ? $btn_border_color : $btn_bg_color, ), '.woocommerce a.button:hover , .woocommerce button.button.alt:hover , .woocommerce-page table.cart td.actions .button:hover, .woocommerce-page #content table.cart td.actions .button:hover, .woocommerce a.button.alt:hover ,.woocommerce .woocommerce-message a.button:hover , .ast-site-header-cart .widget_shopping_cart .buttons .button.checkout:hover , .woocommerce button.button.alt.disabled:hover , .wc-block-grid__products .wc-block-grid__product .wp-block-button__link:hover' => array( 'border-color' => $btn_border_h_color ? $btn_border_h_color : $btn_bg_h_color, ), ); $css_output .= astra_parse_css( $woo_global_button_css ); } if ( ! is_shop() && ! is_product() ) { $css_output .= astra_parse_css( array( '.widget_product_search button' => array( 'flex' => '0 0 auto', 'padding' => '10px 20px;', ), ) ); } if ( $is_site_rtl ) { $woo_product_lang_direction_css = array( '.woocommerce.woocommerce-checkout form #customer_details.col2-set, .woocommerce-page.woocommerce-checkout form #customer_details.col2-set' => array( 'width' => '55%', 'float' => 'right', 'margin-left' => '4.347826087%', ), '.woocommerce.woocommerce-checkout form #order_review, .woocommerce.woocommerce-checkout form #order_review_heading, .woocommerce-page.woocommerce-checkout form #order_review, .woocommerce-page.woocommerce-checkout form #order_review_heading' => array( 'width' => '40%', 'float' => 'left', 'margin-left' => '0', 'clear' => 'left', ), ); } else { $woo_product_lang_direction_css = array( '.woocommerce.woocommerce-checkout form #customer_details.col2-set, .woocommerce-page.woocommerce-checkout form #customer_details.col2-set' => array( 'width' => '55%', 'float' => 'left', 'margin-right' => '4.347826087%', ), '.woocommerce.woocommerce-checkout form #order_review, .woocommerce.woocommerce-checkout form #order_review_heading, .woocommerce-page.woocommerce-checkout form #order_review, .woocommerce-page.woocommerce-checkout form #order_review_heading' => array( 'width' => '40%', 'float' => 'right', 'margin-right' => '0', 'clear' => 'right', ), ); } /* Parse CSS from array()*/ $css_output .= astra_parse_css( $woo_product_lang_direction_css, astra_get_tablet_breakpoint( '', 1 ) ); wp_add_inline_style( 'woocommerce-general', apply_filters( 'astra_theme_woocommerce_dynamic_css', $css_output ) ); /** * YITH WooCommerce Wishlist Style */ $yith_wcwl_main_style = array( '.yes-js.js_active .ast-plain-container.ast-single-post #primary' => array( 'margin' => esc_attr( '4em 0' ), ), '.js_active .ast-plain-container.ast-single-post .entry-header' => array( 'margin-top' => esc_attr( '0' ), ), '.woocommerce table.wishlist_table' => array( 'font-size' => esc_attr( '100%' ), ), '.woocommerce table.wishlist_table tbody td.product-name' => array( 'font-weight' => esc_attr( '700' ), ), '.woocommerce table.wishlist_table thead th' => array( 'border-top' => esc_attr( '0' ), ), '.woocommerce table.wishlist_table tr td.product-remove' => array( 'padding' => esc_attr( '.7em 1em' ), ), '.woocommerce table.wishlist_table tbody td' => array( 'border-right' => esc_attr( '0' ), ), '.woocommerce .wishlist_table td.product-add-to-cart a' => array( 'display' => esc_attr( 'inherit !important' ), ), '.wishlist_table tr td, .wishlist_table tr th.wishlist-delete, .wishlist_table tr th.product-checkbox' => array( 'text-align' => esc_attr( 'left' ), ), '.woocommerce #content table.wishlist_table.cart a.remove' => array( 'display' => esc_attr( 'inline-block' ), 'vertical-align' => esc_attr( 'middle' ), 'font-size' => esc_attr( '18px' ), 'font-weight' => esc_attr( 'normal' ), 'width' => esc_attr( '24px' ), 'height' => esc_attr( '24px' ), 'line-height' => esc_attr( '21px' ), 'color' => esc_attr( '#ccc !important' ), 'text-align' => esc_attr( 'center' ), 'border' => esc_attr( '1px solid #ccc' ), ), '.woocommerce #content table.wishlist_table.cart a.remove:hover' => array( 'color' => esc_attr( $link_color . '!important' ), 'border-color' => esc_attr( $link_color ), 'background-color' => esc_attr( '#ffffff' ), ), ); /* Parse CSS from array() */ $yith_wcwl_main_style = astra_parse_css( $yith_wcwl_main_style ); $yith_wcwl_main_style_small = array( '.yes-js.js_active .ast-plain-container.ast-single-post #primary' => array( 'padding' => esc_attr( '1.5em 0' ), 'margin' => esc_attr( '0' ), ), ); /* Parse CSS from array()*/ $yith_wcwl_main_style .= astra_parse_css( $yith_wcwl_main_style_small, '', astra_get_tablet_breakpoint() ); wp_add_inline_style( 'yith-wcwl-main', $yith_wcwl_main_style ); }
Expand full source code Collapse full source code View on Trac
Changelog
Version | Description |
---|---|
1.0.31 | Introduced. |