• Resolved purplemonkey

    (@purplemonkey)


    The frontpage of my site has three active Storefront widgets:

    – Storefront product categories
    – Storefront featured products
    – Storefront homepage content

    **featured products** is managed via the products page by ticking the “Star” against a product.

    **homepage content** is managed via a “page” on the site, which also has a “edit this section” link over it when logged in via Admin. however I do not know where this link is defined, what if I wanted to change the “page” it references?

    But the main question here is where can I manage what is shown on the **Storefront product categories** widget, it shows only 3 of my 32 categories (5 top. and rest are subcategories of each top). It doesn’t appear to have any order to the ones it shows, reordering them in Product>Categories doesn’t do anything. It used to show the correct categories, but after a recent addition of products and new sub categories it now shows 1 incorrect (incorrect to us) category.

    I noticed in the template-functions.php file the order is by name. So instead of any custom order applied within the woocommerce site it just does it alphabetically. I’ve updated my categories to work using this method, but how can It use the custom order within the site, that would be better?

    $args = apply_filters(
    ‘storefront_product_categories_args’, array(
    ‘limit’ => 3,
    ‘columns’ => 3,
    ‘child_categories’ => 0,
    ‘orderby’ => ‘name’,

    • This topic was modified 4 years, 11 months ago by purplemonkey.
    • This topic was modified 4 years, 11 months ago by purplemonkey.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support kellymetal a11n

    (@kellymetal)

    Hi there!

    the main question here is where can I manage what is shown on the **Storefront product categories** widget, it shows only 3 of my 32 categories (5 top. and rest are subcategories of each top). It doesn’t appear to have any order to the ones it shows, reordering them in Product>Categories doesn’t do anything.

    On my personal site, with the latest version of WooCommerce and Storefront, it appears changing the order of categories under Products > Categories is changing the order of the categories shown in the category section of the Storefront homepage as expected.

    From your description, and the code snippet you included, it looks like it is ordering by name — however, when I check the code in the /storefront/inc/woocommerce/storefront-woocommerce-template-functions.php file, I see it is using 'orderby' => 'menu_order',.

    It seems there may be something changing the behavior on your site, or the files were edited directly at some point.

    You could try adding the following snippet to change it back to using the menu_order from the backend again:

    
    add_filter( 'storefront_product_categories_args', 'my_custom_storefront_category_args' );
    function my_custom_storefront_category_args( $args ){
        $args = array(
                    'limit'            => 3,
                    'columns'          => 3,
                    'child_categories' => 0,
                    'orderby'          => 'menu_order',
                    'title'            => __( 'Shop by Category', 'storefront' ),
                );
        return $args;
    }
    

    You could also try changing the limit and columns there if you wanted to show more categories or display them differently.

    **homepage content** is managed via a “page” on the site, which also has a “edit this section” link over it when logged in via Admin. however I do not know where this link is defined, what if I wanted to change the “page” it references?

    It looks like that link is created in the storefront_homepage_header function, also in the /storefront/inc/storefront-template-functions.php file — however, I don’t see any filter to easily change that. I believe it is just automatically generated based on the page being used for the Homepage. You can set a different page to use as the homepage in the Customizer (Appearance > Customize) in the Homepage Settings tab.

    I hope that helps!

    Thread Starter purplemonkey

    (@purplemonkey)

    Hi,

    Thanks for your assistance, that’s some really valuable information. I probably altered that file when I set the site up some years ago. I always struggle doing things the correct way and end up hacking files directly. one day hopefully I’ll learn.

    After using Stack exchange for most of my tech queries, its a nice reminder that some forums still exist with active users.

    Plugin Support kellymetal a11n

    (@kellymetal)

    Hi there,

    I’m very glad to hear that information helped! : )

    Stack Exchange is certainly a great resource, which I have used myself quite a bit over the years. We do try to help out here as much as we can as well though, so I’m glad that we were able to assist in this case.

    I’m going to mark this thread as resolved. If you have any further questions, please start a new thread.

    Have a wonderful day!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to alter contents of Storefront:Product Categories in the frontpage widget’ is closed to new replies.