matthewduhig
Forum Replies Created
-
Forum: Plugins
In reply to: [WooCommerce - Gift Cards] Latest update BROKE EVERYTHING! EMERGENCYI’ve just had this issue myself too. You’re correct in that it is a compatibility issue with WooCommerce 2.6. From what I can see the get_id() method for WC_Order wasn’t introduced until 2.7, and the gift cards plugin is using this method to get the orders id.
If you’re not sure about updating WooCommerce to 3.0.5 just yet, then an update to 2.7 should fix the issue.
Forum: Plugins
In reply to: [WooCommerce - Gift Cards] SSL Loading of jquery-uiMuch more graceful @avereco. It looks like this has been fixed in 2.4.1.
Forum: Plugins
In reply to: [WooCommerce] Custom search by attributes onlyHey filovewg, thanks for this it helped me on my way to building something similar. Just incase you pop back here, you may find it easier to build your array before setting the query in your pre_get_posts hooked function.
In your original solution you are also overwriting the set->query each time you iterate through the foreach loop.
Here is my complete woo_search_pre_get_posts function
function woo_search_pre_get_posts($query){ // Good practice to also check we are on the main query to ensure others are not effected if ( is_archive() && $query->is_main_query() ) { // Build array for tax query $tax_array = array(); foreach($woo_atts as $att) { // if the attribute is set, add the tax query to our array if(get_query_var($att)) { $tax_array[] = array( 'taxonomy' => 'pa_' . $att, 'field' => 'slug', 'terms' => get_query_var($att) ); } } // Set query only if tax_query array is populated if(!empty($tax_array)) { // use relation 'OR' or 'AND' depending on output required $query->set( 'tax_query', array( 'relation' => 'AND', $tax_array ) ); } } } add_action('pre_get_posts', 'woo_search_pre_get_posts');