Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support omarfpg a11n

    (@omarfpg)

    Hi @umergoldsmith,

    This is unusual and it may mean there’s a problem with your products. Can you share more details as to how those were created? Maybe through a migration/import or through any third party plugin or tool?

    If you create a product now with the default WooCommerce product editor, does it present the same issue?

    Regarding the current errors, let’s try clearing transients. Please head over to WooCommerce → Status → Tools, and do the following:

    • WooCommerce transients – Clear
    • Expired transients – Clear

    Next, please clear your browser and site cache.

    In the meantime, I’d like to understand your site properly. Please share with us the necessary information below for us to investigate the issue further:

    • System Status Report?which you can find via WooCommerce > Status > Get system report > Copy for support.
    • Fatal error logs?(if any) under WooCommerce > Status > Logs.

    You could copy and paste your reply here or paste it via https://gist.github.com/ and send the link here.

    Once we have more information, we’ll be able to assist you further.

    Thanks!
    -OP

    Thread Starter umergoldsmith

    (@umergoldsmith)

    I did one more thing, when i uncheck “Hide out of stock products” in woocommerce settings, then all products are visible, but it also shows hundreds of out of stock products,

    i am not very techie, but i used google help to find a code to hide out of stock products via php function code, but out of stock products still visible on related, and search results,

    do you know any functions.php code to hide out of stock products from everywhere in store?

    Plugin Support ckadenge (woo-hc)

    (@ckadenge)

    Hi @umergoldsmith,

    do you know any functions.php code to hide out of stock products from everywhere in store?

    While customization requests are out of our support scope, I will try to help you with this.

    Please try adding the code below to your child theme:

    add_action('woocommerce_product_query', 'show_only_instock_products');
    
    function show_only_instock_products($query) {
            $meta_query = $query->get( 'meta_query' );
            $meta_query[] = array(
                    'key'       => '_stock_status',
                    'compare'   => '=',
                    'value'     => 'instock'
            );
            $query->set( 'meta_query', $meta_query );
    }

    Should it not work as expected, I recommend the following :

    1. Running the exact question you’re asking, along with the code provided, through an AI platform like ChatGPT for recommendations/changes to your code;
    2. Checking whether there are existing plugins in the WordPress plugin repository that might be doing that already.
    3. Joining our WooCommerce Slack community (it does have a developer channel where you can ask coding questions): https://woo.com/community-slack/

    Hope it helps!

    Plugin Support omarfpg a11n

    (@omarfpg)

    Hi there ?? ,

    We haven’t heard from you in a while; this is to check if you’ve been able to proceed with the troubleshooting steps provided before and if you still need help.

    Thanks!
    -OP

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.