Home › Forums › WoodMart support forum › Issue with wd-swatch not being disabled for variations out of stock
Issue with wd-swatch not being disabled for variations out of stock
- This topic has 6 replies, 2 voices, and was last updated 1 month, 1 week ago by
Aizaz Imtiaz Awan.
-
AuthorPosts
-
January 9, 2025 at 12:56 pm #628540
voltraiderParticipantI am currently experiencing an issue with the wd-swatch feature on my WooCommerce store using the Woodmart theme. When a variation is out of stock (stock = 0), the corresponding swatch is not being disabled or visually distinguished (e.g., grayed out or made transparent).
Attachments:
You must be logged in to view attached files.January 9, 2025 at 3:38 pm #628595
Aizaz Imtiaz AwanKeymasterHello,
Navigate to WooCommerce -> Settings -> Products -> Inventory -> turn off the “Hide out of stock items from the catalog” option.. https://prnt.sc/9uZ_w7CTuRDm and check the issue.
Best Regards
January 10, 2025 at 6:44 am #628676
voltraiderParticipantThis is disabled. It doesn’t help.
January 10, 2025 at 6:51 am #628677
voltraiderParticipantWhen I enabled this option to hide out-of-stock items, I see that it worked. But I don’t want to hide out-of-stock items, as the store should have the Notify about availability option. Is it possible to configure this without it?
January 10, 2025 at 4:30 pm #628831
Aizaz Imtiaz AwanKeymasterHello,
Sorry to say, I am not able to log in or access the WP backend because you have activated the maintenance mode and the WP admin login URL redirects me to the maintenance page. So please send the WP admin login URL so i will further check on your site and give you a possible solution.
Best Regards.
January 10, 2025 at 5:00 pm #628850
voltraiderParticipantI already found a solution. I added the file woocommerce/single-product/add-to-cart/variable.php to the child volume. I added a check there in the code on line 284:
$variation_in_stock = false;
foreach ( $available_variations as $variation ) {
if ( isset( $variation[‘attributes’][ ‘attribute_’ . $attribute_name ] ) &&
$variation[‘attributes’][ ‘attribute_’ . $attribute_name ] === $term->slug &&
$variation[‘is_in_stock’]
) {
$variation_in_stock = true;
break;
}
}if ( !$variation_in_stock ) {
$class .= ‘ wd-variation-out-of-stock’;
}I also added the CSS style in style.css:
.single-product .wd-swatch.wd-variation-out-of-stock {
opacity: 0.5;
}Please check this on your side and make it possible for swatches to become semi-transparent (wd-disabled) if the product is not available, but the products that are not available are not hidden on the site.
January 11, 2025 at 4:29 pm #628967
Aizaz Imtiaz AwanKeymasterHello,
Sorry but there is no option in Theme Settings available for that.
It requires customizations and this is beyond our limitations and support policy.
Regards.
Xtemos Studios -
AuthorPosts
Tagged: out of stock, swatch, wd-swatch
- You must be logged in to create new topics. Login / Register