Changeset 2985019
- Timestamp:
- 10/27/2023 02:45:01 PM (2 years ago)
- Location:
- force-default-variant-for-woocommerce
- Files:
-
- 8 added
- 3 edited
-
tags/1.8 (added)
-
tags/1.8/functions.php (added)
-
tags/1.8/includes (added)
-
tags/1.8/includes/clear-removal.php (added)
-
tags/1.8/includes/settings.php (added)
-
tags/1.8/includes/variations.php (added)
-
tags/1.8/readme.txt (added)
-
tags/1.8/woo-force-default-variant.php (added)
-
trunk/includes/variations.php (modified) (4 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/woo-force-default-variant.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
force-default-variant-for-woocommerce/trunk/includes/variations.php
r2886515 r2985019 74 74 if ( ! $product ) { 75 75 return $defaults; 76 } 77 78 if ( is_string( $product ) ) { 79 $product = wc_get_product( get_queried_object_id() ); 80 if ( empty( $product ) || is_wp_error( $product ) ) { 81 return $defaults; 82 } 76 83 } 77 84 … … 146 153 $secondary_sort = true; 147 154 $attributes = hpy_fdv_multidimensional_sort( $attributes, 'price-low' ); 155 $attributes = hpy_fdv_remove_element_by_value( $attributes, 'price', '0' ); 156 148 157 break; 149 158 … … 151 160 $secondary_sort = true; 152 161 $attributes = hpy_fdv_multidimensional_sort( $attributes, 'price-high' ); 162 $attributes = hpy_fdv_remove_element_by_value( $attributes, 'price', '0' ); 153 163 break; 154 164 … … 237 247 238 248 return apply_filters( 'hpy_fdv_attributes_return', $defaults ); 249 } 250 251 function hpy_fdv_remove_element_by_value($array, $key, $value){ 252 foreach ($array as $subKey => $subArray) { 253 if ($subArray[$key] == $value) { 254 unset($array[$subKey]); 255 } 256 } 257 return $array; 239 258 } 240 259 -
force-default-variant-for-woocommerce/trunk/readme.txt
r2886515 r2985019 3 3 Tags: WooCommerce, Variable product, WooCommerce variant, eCommerce 4 4 Requires at least: 4.2 5 Tested up to: 6. 1.16 Stable tag: 1. 75 Tested up to: 6.3.2 6 Stable tag: 1.8 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 31 31 32 32 == Changelog == 33 = 1.8 - 27th October 2023 = 34 * FIX - Issue with multiple attributes fixed 35 * NEW - Tested and declared compatibility with WC HPOS 36 * UPDATE - Works with WooCommerce 8.2.1 37 * UPDATE - Works with WordPress 6.3.2 38 33 39 = 1.7 - 24th March 2023 = 34 40 * NEW - Adds the ability to order variations Alphabetically -
force-default-variant-for-woocommerce/trunk/woo-force-default-variant.php
r2886515 r2985019 7 7 * Author URI: http://www.happykite.co.uk/ 8 8 * Text Domain: force-default-variant-for-woocommerce 9 * Version: 1. 79 * Version: 1.8 10 10 * WC requires at least: 2.4 11 * WC tested up to: 7.5.111 * WC tested up to: 8.2.1 12 12 */ 13 13 … … 57 57 58 58 } 59 60 /**************************** 61 * Declare HPOS Compatibility 62 ****************************/ 63 64 add_action( 'before_woocommerce_init', function() { 65 if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) { 66 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true ); 67 } 68 } ); 59 69 60 70
Note: See TracChangeset
for help on using the changeset viewer.