' . $price . ''; }, 10, 3 ); add_action( 'woocommerce_before_quantity_input_field', function () { global $blocksy_is_offcanvas_cart; if ( (is_product() || wp_doing_ajax()) && ! blocksy_manager()->screen->uses_woo_default_template() && ! $blocksy_is_offcanvas_cart ) { return; } echo ''; echo ''; } ); add_action( 'woocommerce_before_main_content', function () { $prefix = blocksy_manager()->screen->get_prefix(); if ($prefix === 'woo_categories' || $prefix === 'search') { /** * Note to code reviewers: This line doesn't need to be escaped. * Function blocksy_output_hero_section() used here escapes the value properly. */ echo blocksy_output_hero_section([ 'type' => 'type-2' ]); } $attr = [ 'class' => 'ct-container' ]; if (blocksy_get_page_structure() === 'narrow') { $attr['class'] = 'ct-container-narrow'; } if ($prefix === 'product') { if (blocksy_sidebar_position() === 'none') { $attr['class'] = 'ct-container-full'; $attr['data-content'] = 'normal'; if (blocksy_get_page_structure() === 'narrow') { $attr['data-content'] = 'narrow'; } } echo blocksy_output_hero_section([ 'type' => 'type-2' ]); } echo '
'; if (is_product()) { echo '
'; } else { echo '
'; } if ( $prefix === 'woo_categories' || $prefix === 'search' || $prefix === 'product' ) { /** * Note to code reviewers: This line doesn't need to be escaped. * Function blocksy_output_hero_section() used here escapes the value properly. */ echo blocksy_output_hero_section([ 'type' => 'type-1' ]); } } ); add_action( 'woocommerce_after_main_content', function () { if (is_product()) { echo '
'; } else { echo ''; } get_sidebar(); echo '
'; } ); add_action( 'woocommerce_before_template_part', function ($template_name, $template_path, $located, $args) { global $blocksy_is_offcanvas_cart; if ( $template_name === 'global/quantity-input.php' && ( blocksy_manager()->screen->uses_woo_default_template() || $blocksy_is_offcanvas_cart ) ) { ob_start(); } if ($template_name === 'single-product/up-sells.php') { ob_start(); } if ($template_name === 'single-product/related.php') { ob_start(); } }, 10, 4 ); add_action( 'woocommerce_after_template_part', function ($template_name, $template_path, $located, $args) { global $blocksy_is_offcanvas_cart; if ( $template_name === 'global/quantity-input.php' && ( blocksy_manager()->screen->uses_woo_default_template() || $blocksy_is_offcanvas_cart ) ) { $quantity = ob_get_clean(); echo str_replace( 'class="quantity"', 'class="quantity" data-type="' . get_theme_mod('quantity_type', 'type-1') . '"', $quantity ); } if ($template_name === 'single-product/up-sells.php') { $upsells = ob_get_clean(); echo str_replace( 'class="up-sells upsells products"', 'class="up-sells upsells products ' . trim( blocksy_visibility_classes( get_theme_mod( 'upsell_products_visibility', [ 'desktop' => true, 'tablet' => false, 'mobile' => false, ] ) ) ) . '"', $upsells ); } if ($template_name === 'single-product/related.php') { $related = ob_get_clean(); echo str_replace( 'class="related products"', 'class="related products ' . trim( blocksy_visibility_classes( get_theme_mod( 'related_products_visibility', [ 'desktop' => true, 'tablet' => false, 'mobile' => false, ] ) ) ) . '"', $related ); } }, 4, 4 ); function blocksy_add_minicart_quantity_fields($html, $cart_item, $cart_item_key) { $_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key ); $product_price = apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price($cart_item['data']), $cart_item, $cart_item_key ); if ($_product->is_sold_individually()) { $product_quantity = sprintf( '1 ', $cart_item_key ); } else { $product_quantity = trim(woocommerce_quantity_input( array( 'input_name' => "cart[{$cart_item_key}][qty]", 'input_value' => $cart_item['quantity'], 'max_value' => $_product->get_max_purchase_quantity(), 'min_value' => '0', 'product_name' => $_product->get_name(), ), $_product, false )); } return '
' . $product_quantity . '×' . $product_price . '
'; }