Navigation überspringen

[Gelöst] Custom search field and Query filters for in stock auto filter

This support ticket is created vor 3 months. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Zeitzone des Unterstützers: Asia/Kolkata (GMT+05:30)

Dieses Thema enthält 5 Antworten, hat 1 Stimme.

Zuletzt aktualisiert von peterB-20 vor 3 months.

Assistiert von: Minesh.

Author
Artikel
#2848380

Hi,
Perhaps you can help me with the following?

We are developing a web store based on Woocommerce and Toolset.

The URL is versteckter Link.

Currently, all products are displayed, including those that are “out of stock.”

We only want to display products that are in stock, i.e., “in stock.”
There are two options for this:
* Custom search field
* Query filters

Custom search field works, but is it possible to have the “in stock” radio button enabled by default?

Strangely enough, query filters do not work. I used the following:
* Filter by > Woocommerce block filter fields > Custom field - views_woo_in_stock
* In Query panel > string > equal to > constant = instock

What am I doing wrong here?

Thanks!
Peter

#2848444

Minesh
Unterstützer

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

As I understand - you want to display in-stock products when view loads first time. If this is correct:

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2848587

Minesh
Unterstützer

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

The site was working and suddenly I get the error "This site can’t be reached".

It seems server is blocking the IP or request.

#2848594

FW I guess, Singapore? I should work now, sorry

#2848750

Minesh
Unterstützer

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

I've added the following custom JS code to your archive's JS box:

jQuery(document).ready(function($) {

    var $instockRadio = $('input[name="wpv-_stock_status"][value="instock"]');

    if ($instockRadio.length && !$instockRadio.is(':checked')) {
        $instockRadio.prop('checked', true).trigger('change');
    }

});

More info:
- https://toolset.com/course-lesson/adding-custom-javascript-to-views-templates-and-archives/#steps-for-adding-javascript-to-an-archive

Can you please confirm it works as expected.

#2848766

Thanks, excellent!

I close the ticket.