Tagged: ajax, variations, woocommerce
-
AuthorPosts
-
August 22, 2016 at 5:46 am #675514
Hi Guys.
We have a woocommerce install and
I need to hide from front end view, out of stock Variations.
As you can see in this example we will have many variations that will never have stock (such as 8XL,9Xl etc)
We have the site connected to the stock control system so we always have extra supperfluous variations coming across that we cant control.
I think if we can prevent Ajax from taking over variation display or increase the threshold this will fix the problem. But we cant seem to get the code to work and dont know where to put it.
“(something like this from https://woocommerce.wordpress.com/2015/07/13/improving-the-variations-interface-in-2-4/
function custom_wc_ajax_variation_threshold( $qty, $product ) {
return 10;
}
add_filter( ‘woocommerce_ajax_variation_threshold’, ‘custom_wc_ajax_variation_threshold’, 10, 2 ); ))) ”https://wordpress.org/support/topic/woocommerce-243-hide-nonexistent-variations
At the moment Products with less than 20 variations have the Zero stock level variations hidden. But when there is more variations the Zero stock level variations are visible on the front end.
Thanks for your Help
- This topic was modified 8 years, 3 months ago by offthehook33.
August 23, 2016 at 3:00 pm #676458Hey offthehook33,
Please try adding following code to Functions.php file in Appearance > Editor
function custom_wc_ajax_variation_threshold( $qty, $product ) { return 10; } add_filter( 'woocommerce_ajax_variation_threshold', 'custom_wc_ajax_variation_threshold', 10, 2 );
If that does not work, please create a temporary admin login and post it here privately.
Best regards,
YigitAugust 22, 2017 at 10:59 pm #842804Hello, is this suggestion still valid? My site is still showing product variations that are Out of Stock….thank you!
August 23, 2017 at 1:42 pm #843020Hi Jay Hook,
Have you tried it? Can you give us temporary admin access to your website in the private content box below, so that we can have a closer look?
Best regards,
VictoriaAugust 23, 2017 at 9:00 pm #843266This reply has been marked as private.August 28, 2017 at 5:22 am #844655Hi,
Thank you for the update. I tried to login to the site but the credentials are not working. Please check.
Best regards,
IsmaelSeptember 6, 2017 at 9:18 pm #848843This reply has been marked as private.September 7, 2017 at 5:23 am #848946Hi,
Thank you for the info. Did you set the “Stock status” of each variation and enable the “Out of stock visibility” in the Woocommerce > Settings > Products > Inventory panel?
Where can we see the issue again? Please provide a link to the page.
Best regards,
IsmaelSeptember 20, 2017 at 5:09 pm #854467Hi,
I apologize for not responding, as we were dealing with Hurricane Irma. I’ve posted an example page in the private data area.
If you look at product “07 Dusk”, it is showing in the grid, but that item has a stock of “0”. I did notice, however, that Variation is tagged as “In Stock”.
However, if I go into my Lightspeed Retail account, that product has a stock of “0”, so shouldn’t the variation’s stock status be set to “Out of Stock” whenever an import or sync occurs???
Thanks for the help.
-Jay
September 21, 2017 at 12:27 pm #854785Hi,
I’m sorry to hear about your troubles. I hope your family are fine.
I would like to check the settings again but the login credentials are not working anymore. Please check it.
Best regards,
IsmaelSeptember 26, 2017 at 4:54 pm #857016Hi Ismael,
I just logged in and verified the following credentials. I have posted them in the Private Content section. Thank you!
-Jay
September 27, 2017 at 6:01 am #857303 -
AuthorPosts
- You must be logged in to reply to this topic.