Plugin Directory

Changeset 3237619


Ignore:
Timestamp:
02/10/2025 06:48:05 AM (14 months ago)
Author:
softound
Message:

version 1.6.3

Location:
woo-custom-stock-status/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • woo-custom-stock-status/trunk/includes/class-wc-stock-base.php

    r3056984 r3237619  
    158158                }
    159159                $cat_status = array();
     160
    160161                //EOF sfnd-category-page-changes
    161162                foreach( $variations as $variation_product ) {
     
    194195                        }
    195196                    }
     197
    196198                }
    197199                //BOF sfnd-category-page-changes
     
    320322                        $extra_class  = 's_in_stock_color';
    321323
     324
     325                        //Used to show stock status based on the quantity.
     326                        if( is_plugin_active( 'woo-custom-stock-status-pro/woo-custom-stock-status-pro.php' ) && get_option('wc_slr_show_quantity_based_status') === 'yes'){
     327
     328                            $high_stock_threshold  = get_option('wc_slr_high_stock_threshold');
     329                            $medium_stock_threshold = get_option('wc_slr_medium_stock_threshold');
     330                            $high_stock_status_label = get_option('wc_slr_high_stock_status_label');
     331                            $medium_stock_status_label = get_option('wc_slr_medium_stock_status_label');
     332                            $low_stock_label = get_option('wc_slr_low_stock_label');
     333
     334                            $stock_quantity = $this_obj->get_stock_quantity();
     335
     336                            if ($stock_quantity >= $high_stock_threshold) {
     337                                $availability = $high_stock_status_label;
     338                                $extra_class .= ' high-stock';
     339                            } elseif ($stock_quantity >= $medium_stock_threshold) {
     340                                $availability = $medium_stock_status_label;
     341                                $extra_class .= ' medium-stock';
     342                            } elseif ($stock_quantity > 0) {
     343                                $availability = $low_stock_label;
     344                                $extra_class .= ' low-stock';
     345                            }
     346
     347                        }
     348
    322349                        if ( $this_obj->backorders_allowed() && $this_obj->backorders_require_notification() ) {
    323350                            $availability .= ' ' . __( $can_be_backordered, 'woocommerce' );
     
    368395                $class        = 'available-on-backorder available_on_backorder_color';
    369396
     397            }
     398
     399            $show_backorder_status = get_option( 'wc_slr_show_available_backorder_variation' );
     400
     401            if ($this_obj->is_type('variable')) {
     402                $variations = $this_obj->get_available_variations();
     403
     404                foreach ($variations as $variation) {
     405                    $variation_obj = wc_get_product($variation['variation_id']);
     406                    if ($variation_obj->get_stock_status() === 'onbackorder' && $show_backorder_status === 'yes') {
     407                        $custom_status = $variation_obj->get_meta('_available_on_backorder_status');
     408                        if ($custom_status) {
     409                            $custom_status = $variation_obj->get_meta('_available_on_backorder_status');
     410                            $availability = !empty($custom_status) ? $custom_status : $available_on_backorder;
     411                            $class = 'available-on-backorder available_on_backorder_color';
     412                            break;
     413                        }
     414                    }
     415                }
    370416            }
    371417
  • woo-custom-stock-status/trunk/includes/class-wc-stock-product.php

    r3202307 r3237619  
    232232            <?php
    233233            foreach($this->status_array as $status=>$label){
    234                 ${$status} = get_option( 'wc_slr_show_'.$status.'_in_cart_checkout' , 'yes' );   
    235                 if (${$status} == 'yes') {
     234                ${$status} = get_option( 'wc_slr_show_'.$status.'_in_cart_checkout' , 'yes' ); 
     235                $show_status = get_option( 'wc_slr_show_in_cart_page' , 'yes' );
     236                if (${$status} == 'yes' && $show_status == 'yes') {
    236237                ?>
    237238                <style type="text/css"> .stock.<?php echo esc_attr($status).'_color'; ?> { display: block; }.wc-block-components-product-name .stock{ display: none; }</style>
    238239                <?php
    239                 }
     240                }else{ ?>
     241                    <style type="text/css">.wc-block-components-product-name .stock{ display: none; }</style>
     242               <?php }
    240243            }
    241244        }
     
    893896   
    894897        $hide_product_status = get_post_meta($product_id,'hide_stock_status',true);
    895         if( ( ( $on_backorder === true ) || ( $show_status_in_email == 'yes' ) ) && ( $product_id > 0 ) ) {
     898        if( ( $show_status_in_email == 'yes' ) && ( $product_id > 0 ) ) {
    896899
    897900            if( $on_backorder === true && $hide_product_status != 'yes'){
  • woo-custom-stock-status/trunk/includes/class-wc-stock-setting.php

    r3199888 r3237619  
    6161            }
    6262
     63            .woocommerce table.form-table.woo-custom-stock-status .forminp{
     64                display: revert;
     65            }
    6366        </style>
    6467        <?php
     
    162165
    163166        $js = '<script>';
    164         $wc_slr_stock_status_after_addtocart = get_option( 'wc_slr_stock_status_after_addtocart', 'no' );
    165         if($wc_slr_stock_status_after_addtocart=='yes'){
    166             $js .= "jQuery(function(){ var stock_html = jQuery('.product .summary .stock').clone();jQuery('.product .summary .stock').remove();jQuery(stock_html).insertAfter('form.cart'); });";
    167             //For block theme
    168             $js .= "jQuery(function(){ var stock_html = jQuery('.product .wp-block-column .wp-block-woocommerce-product-price .stock').clone();jQuery('.product .wp-block-column .wp-block-woocommerce-product-price .stock').remove();jQuery(stock_html).insertAfter('form.cart'); });";
     167        $wc_slr_stock_status_after_addtocart = get_option('wc_slr_stock_status_after_addtocart', 'no');
     168        if ($wc_slr_stock_status_after_addtocart == 'yes') {
     169            $js .= "jQuery(function() {
     170                // Check if the Add to Cart button is available
     171                if (jQuery('form.cart').length > 0) {
     172                    // Move stock status below the Add to Cart button
     173                    var stock_html = jQuery('.product .summary .stock').clone();
     174                    jQuery('.product .summary .stock').remove();
     175                    jQuery(stock_html).insertAfter('form.cart');
     176                }
     177            });";
     178            // For block theme
     179            $js .= "jQuery(function() {
     180                // Check if the Add to Cart button is available
     181                if (jQuery('form.cart').length > 0) {
     182                    var stock_html = jQuery('.product .wp-block-column .wp-block-woocommerce-product-price .stock').clone();
     183                    jQuery('.product .wp-block-column .wp-block-woocommerce-product-price .stock').remove();
     184                    jQuery(stock_html).insertAfter('form.cart');
     185                }
     186            });";
    169187        }
    170188        $js .= '</script><!-- woo-custom-stock-status-js -->';
     189       
    171190        echo $js;
    172191       
  • woo-custom-stock-status/trunk/readme.txt

    r3202307 r3237619  
    55Requires at least: 5.8
    66Tested up to: 6.7
    7 Stable tag: 1.6.2
     7Stable tag: 1.6.3
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    5555➜ [Bulk edit status for variables type products](https://softound.com/products/woo-custom-stock-status-pro/) [PRO]
    5656➜ [Hide variable product stock status in category page](https://softound.com/products/woo-custom-stock-status-pro/) [PRO]
     57➜ [Show stock status based on quantity](https://softound.com/products/woo-custom-stock-status-pro/) [PRO]
    5758
    5859[Click here for live demo](https://demo.softound.com/woo-custom-stock-status/)
     
    263264* Fix - Resolved the "Learn more" shortcode display issue on Porto theme.
    264265
     266= 1.6.3 - 04/02/25 =
     267* Fix - Show/Hide stock status on cart page option issue fixed
     268* Fix - Show stock status on frontend when product is out of stock.
     269* Feature - Added new option to show "Available on Backorder" status for variation products on the listing page
     270
    265271== Upgrade Notice ==
    266272
     
    431437Fix - Resolved the "Learn more" shortcode display issue on Porto theme.
    432438
     439= 1.6.3 - 04/02/25 =
     440Fix - Show/Hide stock status on cart page option issue fixed
     441Fix - Show stock status on frontend when product is out of stock.
     442Feature - Added new option to show "Available on Backorder" status for variation products on the listing page
  • woo-custom-stock-status/trunk/woo-custom-stock-status.php

    r3202307 r3237619  
    44Plugin URI:  https://www.softound.com/
    55Description: Write the custom stock status with different colors for each woocommerce product, to show in product details and listing pages.
    6 Version:     1.6.2
     6Version:     1.6.3
    77Author:      Softound Solutions
    88Author URI:  https://www.softound.com/
     
    1515define( 'WCSS_PLUGIN_PATH', plugin_dir_path( __FILE__ ));
    1616define( 'WCSS_PLUGIN_URL', plugin_dir_url(__FILE__));
    17 define( 'WCSS_PLUGIN_VER', '1.6.2');
     17define( 'WCSS_PLUGIN_VER', '1.6.3');
    1818
    1919/**
Note: See TracChangeset for help on using the changeset viewer.