ResolvedProduct Stock Status Labels/Highlights

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #24772
    Pablo
    Participant

    Hi,

    This is along the same lines as the question I had for being able to filter on the product stock status ( $product->get_stock_status() ) which can be “In Stock”, “On Backorder” or “Out of Stock”.

    This is a feature request:
    Under the theme options in the shop tab you have the setting to be able to show the “Out of Stock” label on a product which also greys out the image. Would it be possible to add an “On backorder” label too? Even better if the product image is greyed out for no backorders allowed but normal image for when backorders are allowed…

    This is a question/feature request:
    When using variations Woocommerce does not allow for checking the stock status (or quantity) until you click on the variation. For the drop down list I found some code which can be added to the functions.php file but this only covers for Out of Stock items. If I am using the Rigid Swatch to list the variations as labels would it be possible to highlight the swatch label in a colour according to preference (e.g. green = “In Stock”, orange=”on backorder” and red = “out of stock”)? Then you have a colour legend so the customer does not have to click on variations to see that the product is then possibly not available.

    Would this be possible with either CSS or does the code within Rigid theme need to be modified if it is even easy to implement?

    The code I found online…

    /**
     * Disable out of stock variations
     * https://github.com/woocommerce/woocommerce/blob/826af31e1e3b6e8e5fc3c1004cc517c5c5ec25b1/includes/class-wc-product-variation.php
     * @return Boolean
     */
    function wcbv_variation_is_active( $active, $variation ) {
     if( ! $variation->is_in_stock() ) {
     return false;
     }
     return $active;
    }
    add_filter( 'woocommerce_variation_is_active', 'wcbv_variation_is_active', 10, 2 );

    Kind regards,

    #24773
    Pablo
    Participant

    Oh, and the div class is

    .rigid-wcs-swatches

    #24803
    Althemist
    Keymaster

    Hi zuyo,

    No, I am afraid there is no easy way to achieve this on the single product page variations. I’ll discuss with the team, but I am not really sure if it’s even possible.

    As for marking the products on backorder in listings – yes, this can be done. We will add it for the next major update. However, I wouldn’t be able to give you any strict ETA.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in and have valid license to reply to this topic.

License required for the following item
Login and Registration Log in · Register