• Hi, I’m having a problem with my custom sorting. I’ve looked everywhere. I am a complete beginner. I did the custom sorting and re-ordered my products in attributes (0-7). In settings for woocommerce I have “custom sorting” selected. However, only one of my products are displaying (#3) –> https://realbrowngirls.com/shop/ If I click sort using a different option (asc/des) then all of my products are displayed. I’m completely confused! Please help!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi there realbrowngirls — that sounds super frustrating. I’m not an official support person, I’m just someone trying to learn WooCommerce by helping other folks with their problems. I saw the behavior you described (only one of your products shows up), but I’m a little unclear on a few things you said. If you could clarify them, that might help me (or someone else) solve your problem.

    When you say “I did the custom sorting” — what do you mean by this? Did you follow a tutorial somewhere? Installing a plugin? If so, which tutorial or plugin?

    Also, when you say In settings for woocommerce I have “custom sorting” selected — which WordPress navigation did you click on to get there?

    With that information someone might be able to better understand your problem and help out.

    Cheers!

    Thread Starter realbrowngirls

    (@realbrowngirls)

    Hi alanstorm! Thank you so much for your response! I apologize for being unclear.

    The link here explains what I did as far as custom sorting (when I added the products in woocommerce –> products –> sort I rearranged them by dragging up and down).

    The above link also explains what I did in settings. Woocommerce –> settings –> products –> show products (both are selected) –> default sorting is selected. That is where my problem comes in because it’s not adhering to the default sorting “custom ordering” that I created on the products page.

    I’ve read some more and since installed a plug-in, Woocommerce Extra Product Sorting Options in hopes of it rectifying the situation. Unfortunately, that hasn’t changed anything! The new sorting options aren’t loading at all!

    Again THANK YOU for any help that you can provide!

    Got it realbrowngirls, that makes sense. I poked around at my local install and wasn’t able to reproduce your problem. This means the problem isn’t with WooCommerce itself, but some customization, plugin, or WooCommerce bug specific to your data. Have you changed any core WordPress files? Added any theme templates?

    If I was debugging this in front of your computer/server, I’d start by disabling any/all third party plugins. This can often make the problem go away. Once that problem goes away — reenable the plugins one by one until the problem reappears. This will let you know which plugin is causing the problem.

    If this is not a plugin problem (i.e. disabling every plugin doesn’t help) then the next thing I’d do is some advanced SQL debugging. This will involve some temporary editing of a core WordPress file. If you’re not comfortable with things like this you don’t need to try it. That said — although it’s technical, it’s one way to really get at the bottom of what your WordPress system is up to.

    First, make a backup copy of the file

    wp-includes/query.php

    Once you’ve done that, look for the section of query.php (the original, not your backup, around line 3785) that looks like this

    if ( $q['update_post_term_cache'] ) {
    			wp_queue_posts_for_term_meta_lazyload( $this->posts );
    		}
    
    		return $this->posts;

    Add the following echo line right above the return

    echo $this->request;
    return $this->posts;

    and reload your /shop/ page. You should see the SQL query that fetches the products at the top of your page. This query is what Woo uses to lookup your products. For some reason, in your system, this returns only a single product on the main listing page. If you could copy/paste this query for the main listing page (with one product) and a specific listing page (that shows all products) it may illuminate what’s wrong with your system.

    Hope that helps, and apologies if I went off the technical deep end — that’s sort of my jam ?? Best wishes, and good luck!

    Hey there realbrowngirls — I’ve been doing some semi-related digging into WordPress today and discovered the Query Monitor plugin. If you can install this, it will let you view which SQL queries your page page without the need to edit the file I mentioned above. If you can install that I can guide you through how to find the query that’s fetching your products, and we can maybe figure out what’s going on with your system.

    Thread Starter realbrowngirls

    (@realbrowngirls)

    Hey hey alanstorm!! THANK YOU! THANK YOU! THANK YOU! Somehow it worked itself out. I was in the midst of deactivating plug-ins like you’d said, when I noticed woocommerce had an update. I updated and now all of the products appear! However, they’re now distorted. I would still love to be walked through the Query Monitor plugin for future reference. If you don’t mind, could you please still walk me through it? THANK YOU a bunch!

    Thread Starter realbrowngirls

    (@realbrowngirls)

    Also, I have not changed any core WordPress files nor have I changed those of the theme. I did update the theme as it was outdated. Question: I made a backup of the entire database. If I wanted to find the the wp-includes/query.php portion of the code, where do I look for the original (developer tools on the actual page?)?

    realbrowngirls — it sounds like there might have been a bug in the version of WooCommerce you were using that was fixed in the latest update. i.e. other people had a problem similar to yours and the core team fixed it. Re: distorted — do you mean the images look like they’re the wrong size? Or something else?

    Re: query monitor — if you install that plugin, and are logged into your WordPress site as an admin, you should see some extra text in your admin bar (next to the +New button) that looks something like this 0.51S 35.30MB 0.0123S 33Q. Click on that cryptic text and you should get a menu like this

    – Queries
    – Queries by Caller
    – Queries by Component
    – Request
    – Rewrite Rules
    – Template: index.php
    – Scripts & Styles
    – Hooks
    – Languages
    – HTTP Requests (1)
    – Transients Set (1)
    – Environment
    – is_front_page()
    – is_home()

    Click on the “Queries” option and you’ll jump to the bottom of your page, where you’ll see **all** the SQL queries used to build your page request. There will be a large number of these, some will seem redundant. This is what WordPress’s core code is doing behind the scenes to do **everything** on your site. It can be a little overwhelming, and even seasoned technical WordPress veterans may not known (off the top of their head) what everything is for.

    Our next steps here would have been finding the query that looks like this

    `SELECT SQL_CALC_FOUND_ROWS wp_posts.ID
    FROM wp_posts
    WHERE 1=1

    LIMIT 0, 10`

    next to the WP_Query->get_posts() “Caller”, and then we’d be able to examine what additional WHERE clauses were restricting your query to a single product, and that might have pointed out where our problem was.

    Finally, when you say

    Question: I made a backup of the entire database. If I wanted to find the the wp-includes/query.php portion of the code, where do I look for the original (developer tools on the actual page?)?

    How did you “backup the entire database?” You would have needed to backup your entire database **and** the individual files that make up WordPress and its plugins. When you updated the WooCommerce plugin, it updates files in wp-content/plugins/woocommerce. Without getting too deeply into it, these files change the behavior of the code in wp-includes/query.php to make query.php fetch your products. Whatever bug caused your problem was fixed when you updated these files. Since those files are now updated, you won’t be able to reproduce the bug. (if this sounds maddening, it is, and it’s the sort of thing the people who make WordPress and software like it get to deal with every day)

    It sounds like you’re one your way — I hope I was more helpful than confusing! Best wishes!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘1 Product Showing in Custom Sort’ is closed to new replies.