Changeset 3237619
- Timestamp:
- 02/10/2025 06:48:05 AM (14 months ago)
- Location:
- woo-custom-stock-status/trunk
- Files:
-
- 5 edited
-
includes/class-wc-stock-base.php (modified) (4 diffs)
-
includes/class-wc-stock-product.php (modified) (2 diffs)
-
includes/class-wc-stock-setting.php (modified) (2 diffs)
-
readme.txt (modified) (4 diffs)
-
woo-custom-stock-status.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
woo-custom-stock-status/trunk/includes/class-wc-stock-base.php
r3056984 r3237619 158 158 } 159 159 $cat_status = array(); 160 160 161 //EOF sfnd-category-page-changes 161 162 foreach( $variations as $variation_product ) { … … 194 195 } 195 196 } 197 196 198 } 197 199 //BOF sfnd-category-page-changes … … 320 322 $extra_class = 's_in_stock_color'; 321 323 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 322 349 if ( $this_obj->backorders_allowed() && $this_obj->backorders_require_notification() ) { 323 350 $availability .= ' ' . __( $can_be_backordered, 'woocommerce' ); … … 368 395 $class = 'available-on-backorder available_on_backorder_color'; 369 396 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 } 370 416 } 371 417 -
woo-custom-stock-status/trunk/includes/class-wc-stock-product.php
r3202307 r3237619 232 232 <?php 233 233 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') { 236 237 ?> 237 238 <style type="text/css"> .stock.<?php echo esc_attr($status).'_color'; ?> { display: block; }.wc-block-components-product-name .stock{ display: none; }</style> 238 239 <?php 239 } 240 }else{ ?> 241 <style type="text/css">.wc-block-components-product-name .stock{ display: none; }</style> 242 <?php } 240 243 } 241 244 } … … 893 896 894 897 $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 ) ) { 896 899 897 900 if( $on_backorder === true && $hide_product_status != 'yes'){ -
woo-custom-stock-status/trunk/includes/class-wc-stock-setting.php
r3199888 r3237619 61 61 } 62 62 63 .woocommerce table.form-table.woo-custom-stock-status .forminp{ 64 display: revert; 65 } 63 66 </style> 64 67 <?php … … 162 165 163 166 $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 });"; 169 187 } 170 188 $js .= '</script><!-- woo-custom-stock-status-js -->'; 189 171 190 echo $js; 172 191 -
woo-custom-stock-status/trunk/readme.txt
r3202307 r3237619 5 5 Requires at least: 5.8 6 6 Tested up to: 6.7 7 Stable tag: 1.6. 27 Stable tag: 1.6.3 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 55 55 ➜ [Bulk edit status for variables type products](https://softound.com/products/woo-custom-stock-status-pro/) [PRO] 56 56 ➜ [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] 57 58 58 59 [Click here for live demo](https://demo.softound.com/woo-custom-stock-status/) … … 263 264 * Fix - Resolved the "Learn more" shortcode display issue on Porto theme. 264 265 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 265 271 == Upgrade Notice == 266 272 … … 431 437 Fix - Resolved the "Learn more" shortcode display issue on Porto theme. 432 438 439 = 1.6.3 - 04/02/25 = 440 Fix - Show/Hide stock status on cart page option issue fixed 441 Fix - Show stock status on frontend when product is out of stock. 442 Feature - 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 4 4 Plugin URI: https://www.softound.com/ 5 5 Description: Write the custom stock status with different colors for each woocommerce product, to show in product details and listing pages. 6 Version: 1.6. 26 Version: 1.6.3 7 7 Author: Softound Solutions 8 8 Author URI: https://www.softound.com/ … … 15 15 define( 'WCSS_PLUGIN_PATH', plugin_dir_path( __FILE__ )); 16 16 define( 'WCSS_PLUGIN_URL', plugin_dir_url(__FILE__)); 17 define( 'WCSS_PLUGIN_VER', '1.6. 2');17 define( 'WCSS_PLUGIN_VER', '1.6.3'); 18 18 19 19 /**
Note: See TracChangeset
for help on using the changeset viewer.