hooks(); return self::$_instance; } public function hooks() { // Remove actions remove_action('woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5); remove_action('woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15); remove_action('woocommerce_after_shop_loop_item', 'woocommerce_template_loop_product_link_close', 5); remove_action('woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10); remove_action('woocommerce_sidebar', 'woocommerce_get_sidebar', 10); // Remove sorting option $hide_product_sorting = agency_ecommerce_get_option('hide_product_sorting'); if (true === $hide_product_sorting) { remove_action('woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30); } // Disable Related Products $disable_related_products = agency_ecommerce_get_option('disable_related_products'); if (true === $disable_related_products) { remove_action('woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20); } add_filter('loop_shop_columns', array($this, 'product_columns')); add_filter('woocommerce_output_related_products_args', array($this, 'related_products_args')); add_action('woocommerce_after_single_product_summary', array($this, 'output_upsells'), 15); add_action('woocommerce_shop_loop_item_title', array($this, 'woocommerce_template_loop_product_title'), 10); add_action('woocommerce_sidebar', array($this, 'woocommerce_sidebar'), 10); add_filter('loop_shop_per_page', array($this, 'new_loop_shop_per_page'), 20); add_filter('woocommerce_add_to_cart_fragments', array($this, 'header_add_to_cart_fragment')); $hide_list_grid_view = (boolean)agency_ecommerce_get_option('hide_list_grid_view'); // Shop List View and Grid View if (!$hide_list_grid_view) { add_filter('woocommerce_before_shop_loop', array($this, 'before_shop_loop'), 35); } $show_product_excerpt = (boolean)agency_ecommerce_get_option('show_product_excerpt'); // Show excerpt or not if (!$hide_list_grid_view || $show_product_excerpt) { add_filter('woocommerce_after_shop_loop_item', array($this, 'before_shop_loop_item'), 15); } $is_sticky_add_to_cart = (boolean)agency_ecommerce_get_option('sticky_add_to_cart'); if ($is_sticky_add_to_cart) { add_action('agency_ecommerce_after_footer', array($this, 'sticky_single_add_to_cart'), 15); } add_action('woocommerce_proceed_to_checkout', array($this, 'woocommerce_continue_shopping'), 25); } public function woocommerce_continue_shopping() { $woo_continue_shopping_text = agency_ecommerce_get_option('woo_continue_shopping_text'); if (!empty($woo_continue_shopping_text)) { $shop_page_url = get_permalink(wc_get_page_id('shop')); echo ''; echo esc_html($woo_continue_shopping_text); echo ''; } } public function product_columns() { $product_number = agency_ecommerce_get_option('product_number'); return absint($product_number); // number of products per row } public function related_products_args($args) { $product_number = agency_ecommerce_get_option('product_number'); $args['columns'] = absint($product_number); $args['posts_per_page'] = absint($product_number); // number of related products return $args; } public function output_upsells() { $product_number = agency_ecommerce_get_option('product_number'); woocommerce_upsell_display(absint($product_number), absint($product_number)); // Display 3 products in rows of 3 } public function woocommerce_template_loop_product_title() { echo '
' . agency_ecommerce_get_the_excerpt($woo_shop_excerpt_length) . '