skip to Main Content

I’m trying to change the default content on my shop page. My site is using WooCommerce with a child of the Storefront theme.

In my child theme’s functions.php I added the following:

function remove_catalog_defaults() {
    remove_action( 'homepage', 'storefront_homepage_content', 10 );
    remove_action( 'homepage', 'storefront_product_categories', 20 );
    remove_action( 'homepage', 'storefront_recent_products', 30 );
    remove_action( 'homepage', 'storefront_featured_products', 40 );
    remove_action( 'homepage', 'storefront_popular_products', 50 );
    remove_action( 'homepage', 'storefront_on_sale_products', 60 );
    remove_action( 'homepage', 'storefront_best_selling_products', 70 );
    
    remove_action( 'woocommerce_after_shop_loop', 'storefront_sorting_wrapper', 9 );
    remove_action( 'woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 10 );
    remove_action( 'woocommerce_after_shop_loop', 'woocommerce_result_count', 20 );
    remove_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 30 );
    remove_action( 'woocommerce_after_shop_loop', 'storefront_sorting_wrapper_close', 31 );

    remove_action( 'woocommerce_before_shop_loop', 'storefront_sorting_wrapper', 9 );
    remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 10 );
    remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 );
    remove_action( 'woocommerce_before_shop_loop', 'storefront_woocommerce_pagination', 30 );
    remove_action( 'woocommerce_before_shop_loop', 'storefront_sorting_wrapper_close', 31 );
}

add_action( 'storefront_before_content', 'remove_catalog_defaults', 5);

But everything is still loading on the shop page. You can see it here:
https://staging.embrace.gallery/all-artwork/

First the content I want loads (4 rows of products), then the default shop page loads underneath it. How do I get rid of all the default content?

EDIT: Some of the remove_action calls seem to be working. The sorting and pagination are gone, only the product grid itself remains.

2

Answers


  1. Chosen as BEST ANSWER

    This isn't a code-based solution, but it works for my purposes:

    I created a dummy page and told WooCommerce it's the shop page. Then WooCommerce stops trying to load all the extra products on the actual shop page. This won't mess up the breadcrumb because I got rid of that. I'm also replacing the Category pages with custom ones I designed, so I'm just going to try and change all the default links on the product pages to go to my own pages instead of the WooCommerce pages.


  2. Try after_setup_theme action hook.

    function remove_catalog_defaults() {
        remove_action( 'homepage', 'storefront_homepage_content', 10 );
        remove_action( 'homepage', 'storefront_product_categories', 20 );
        remove_action( 'homepage', 'storefront_recent_products', 30 );
        remove_action( 'homepage', 'storefront_featured_products', 40 );
        remove_action( 'homepage', 'storefront_popular_products', 50 );
        remove_action( 'homepage', 'storefront_on_sale_products', 60 );
        remove_action( 'homepage', 'storefront_best_selling_products', 70 );
        
        remove_action( 'woocommerce_after_shop_loop', 'storefront_sorting_wrapper', 9 );
        remove_action( 'woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 10 );
        remove_action( 'woocommerce_after_shop_loop', 'woocommerce_result_count', 20 );
        remove_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 30 );
        remove_action( 'woocommerce_after_shop_loop', 'storefront_sorting_wrapper_close', 31 );
    
        remove_action( 'woocommerce_before_shop_loop', 'storefront_sorting_wrapper', 9 );
        remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 10 );
        remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 );
        remove_action( 'woocommerce_before_shop_loop', 'storefront_woocommerce_pagination', 30 );
        remove_action( 'woocommerce_before_shop_loop', 'storefront_sorting_wrapper_close', 31 );
    }
    add_action( 'after_setup_theme', 'remove_catalog_defaults' );
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search