Commit Graph

24976 Commits

Author SHA1 Message Date
Luciano Amodio 865efa3736 Add product export row action hook
having this hook is possible to actually use the woocommerce_product_export_product_query_args filter

```
add_action('woocommerce_product_export_row', 'export_custom_product');
add_filter( 'woocommerce_product_export_product_query_args', 'export_product_query_args');

// https://github.com/woocommerce/woocommerce/wiki/wc_get_products-and-WC_Product_Query
add_filter( 'woocommerce_product_data_store_cpt_get_products_query', 'handle_custom_query_var', 10, 2 );

function export_custom_product() {
  $args = [
    'show_option_all' =>  'Custom',
    'taxonomy'        =>  'pa_custom',
    'name'            =>  'custom',
    'orderby'         =>  'name',
    'order'           => 'ASC',
    'selected'        =>  isset($_REQUEST['custom']) ? $_REQUEST['custom'] : '',
    'show_count'      =>  true,
    'hide_empty'      =>  true,
    'menu_order'      => false
  ];
  ?>
  <tr>
    <th scope="row">
      <label for="custom">Filter by Custom</label>
    </th>
    <td>
      <?php wp_dropdown_categories($args); ?>
    </td>
  </tr>
  <?php
}

function export_product_query_args($args) {
  $args['custom'] = 'default';

  if ( ! empty( $_POST['form'] ) ) {
    $values = explode('=', $_POST['form']);
    if('custom' === $values[0]) {
      $args['custom'] = wp_unslash( $values[1] );
    }
  }

  return $args;
}

function handle_custom_query_var( $query, $query_vars ) {
  if ( ! empty( $query_vars['custom'] ) ) {
    $query['tax_query'][] = array(
      'taxonomy' => 'pa_ custom',
      'field' => 'id',
      'terms' => esc_attr( $query_vars['custom'] )
    );
  }

  return $query;
}
```
2017-12-20 20:13:10 +01:00
Claudiu Lodromanean 906efe1ffc
Merge pull request #18189 from woocommerce/fix/17897
Add getter for tax_display_cart variable, with filter
2017-12-15 08:44:43 -08:00
Claudiu Lodromanean f89eab057b
Merge pull request #18194 from woocommerce/fix/18179
Out of stock should not show qty in grouped products.
2017-12-15 08:38:32 -08:00
Claudiu Lodromanean 237111f337
Merge pull request #18188 from woocommerce/fix/18150
Only get ID when it's not empty so 0 and '' is ignored
2017-12-15 08:27:28 -08:00
Mike Jolley 06a7570f4b Out of stock should not show qty in grouped products. 2017-12-15 15:32:50 +00:00
Mike Jolley 1901493eee Should be pulic. 2017-12-15 15:18:17 +00:00
Mike Jolley d90b817598 Merge pull request #18187 from woocommerce/fix/18182-storefront-wizard-notice
Fix wc_is_active_theme test
2017-12-15 13:44:40 +00:00
Mike Jolley 01871fd2c8 Add getter for tax_display_cart variable, with filter 2017-12-15 13:39:35 +00:00
Mike Jolley 47b39caf83 phpcs 2017-12-15 13:19:23 +00:00
Mike Jolley ea8681280a Only get ID when it's not empty so 0 and '' is ignored 2017-12-15 12:59:54 +00:00
Gerhard Potgieter d512421fa1 Make the test work on any test platform 2017-12-15 14:51:47 +02:00
Mike Jolley fd2c676837
Merge pull request #18184 from woocommerce/fix/18182-storefront-wizard-notice
Storefront in wizard for non WC themes and default themes
2017-12-15 12:51:19 +00:00
Gerhard Potgieter 58457dab3a Unit tests for wc_is_active_theme 2017-12-15 14:43:56 +02:00
Gerhard Potgieter 4ba9af1c2f Change WC::is_active_theme into a global function wc_is_active_theme. Clean up the conditional checks to read better. 2017-12-15 14:32:54 +02:00
Mike Jolley 7c029d18e9
Merge pull request #18186 from woocommerce/fix/no-strict-array-select-settings
Option value comparison when saving select settings
2017-12-15 12:18:26 +00:00
Gerhard Potgieter 89d21a50a4 Convert allowed options to string values for comparison, html options have no data type distiction. 2017-12-15 13:39:05 +02:00
Gerhard Potgieter 30398a65f1 Do not use strict comparison when doing in_array on select settings as wp_unslash on the raw_value will return a string that fails comparison with int values. 2017-12-15 13:21:01 +02:00
Mike Jolley d14d3afc2e
Merge pull request #18162 from WPprodigy/downloads-logging-enhancements
[3.3] New download logging reports enhancements
2017-12-15 11:09:21 +00:00
Caleb Burks 5130740aca Escaping 2017-12-15 04:26:22 -06:00
Gerhard Potgieter 2907725e5c Display storefront theme in wizard when theme does not support woocommerce, or a default theme.
Closes #18182
2017-12-15 10:23:31 +02:00
Claudiu Lodromanean 650faf6450
Merge pull request #18169 from woocommerce/add/unit-tests
Widget unit tests
2017-12-14 13:19:21 -08:00
Claudiu Lodromanean e7c36890a1
Merge pull request #18178 from woocommerce/fix/18154
Improve default select2 styles
2017-12-14 09:27:10 -08:00
Claudiu Lodromanean 204a990976
Merge pull request #18173 from woocommerce/fix/18168
Add ID orderby fallback for when prices are the same across multiple products.
2017-12-14 09:16:37 -08:00
Claudiu Lodromanean 5bf6ff0d48
Merge pull request #18172 from woocommerce/fix/18164-includes
Only show includes text when there are taxes
2017-12-14 09:14:38 -08:00
Claudiu Lodromanean 9cfc587d2e
Merge pull request #18160 from WPprodigy/hide-stock-status-on-variations
[3.3] Hide variation stock status setting conditionally
2017-12-14 09:05:01 -08:00
Mike Jolley e3b61f6203
Merge pull request #18151 from woocommerce/fix/18149
Save offline gateways in wizard
2017-12-14 16:45:20 +00:00
Mike Jolley 9bf677d48d
Merge pull request #18143 from woocommerce/fix/18142
Fix order of functions in wc_get_post_data_by_key
2017-12-14 16:42:21 +00:00
Mike Jolley 1555507756
Merge pull request #18123 from woocommerce/update/setup-wizard-omit-paypal-standard
Setup wizard: Omit PayPal Standard unless plugins cannot be installed
2017-12-14 16:42:03 +00:00
Mike Jolley 99fb55144f Improve default select2 styles 2017-12-14 16:37:51 +00:00
Mike Jolley a1f5e2be95
Merge pull request #18163 from woocommerce/fix/plugin-override-warnings
Fix warning for plugins that override this method with the specified …
2017-12-14 14:48:39 +00:00
Boro Sitnikovski 59c1aa0928 Add since tag 2017-12-14 15:43:35 +01:00
Boro Sitnikovski 080ece9588 Change method name 2017-12-14 15:37:42 +01:00
Mike Jolley 1df3af081c Add ID orderby fallback for when prices are the same across multiple products. 2017-12-14 14:17:20 +00:00
Mike Jolley a6594d6880 Only show includes text when there are taxes 2017-12-14 14:04:20 +00:00
Mike Jolley bfe7b835a3
Merge pull request #18157 from WPprodigy/customizer-string-updates
[3.3] Customizer string updates
2017-12-14 13:00:09 +00:00
Mike Jolley 3204e39a90
Merge pull request #18156 from WPprodigy/fix-18155-image-cropping
[3.3] Use correct image options in customizer settings
2017-12-14 12:56:52 +00:00
Gerhard Potgieter 549b4bfa1a Widget unit tests 2017-12-14 13:57:53 +02:00
Rodrigo Primo 890aaeaa8a
Merge pull request #18166 from shivapoudel/fix/duplicate
Tweak - Duplicate relevance orderby for catalog
2017-12-14 09:53:03 -02:00
Gerhard Potgieter 276bff133f Improve unit test coverage (#18136)
* Test for main WooCommerce class

* Check all class instances created from main class.

* Test all constants

* Test for deprecated hook handler classes as well

* Test template path constant

* Check static class instances

* get_cart_item_quantities test

* get_cart_item_quantities & get_cart_contents_weight tests

* check_cart_items test

* Check_cart_item_stock test

* Cart get_cross_sells test

* Cart get_tax_totals test

* WC_Customer_Download_Data_Store tests
2017-12-14 08:45:00 -02:00
Shiva Poudel 3353505be5 Tweak - Duplicate relevance orderby for catalog 2017-12-14 15:37:12 +05:45
Boro Sitnikovski e1b753122e Deprecate the function as a whole 2017-12-14 10:23:51 +01:00
Boro Sitnikovski e061cb122c Fix warning for plugins that override this method with the specified parameter 2017-12-14 10:09:25 +01:00
Gerhard Potgieter 2f477887fb Merge branch 'master' of github.com:woocommerce/woocommerce into add/unit-tests 2017-12-14 10:56:01 +02:00
Gerhard Potgieter 89d0aa0a2f WC_Customer_Download_Data_Store tests 2017-12-14 10:12:56 +02:00
Caleb Burks b8e208269e Adjust download reporting active filters display 2017-12-14 00:13:53 -06:00
Caleb Burks 76a2e5fe87 Capitalization fix 2017-12-13 23:59:20 -06:00
Caleb Burks cb154b5d40 Add button for copying DL link 2017-12-13 23:57:47 -06:00
Caleb Burks 345376bc20 Add customer download report section 2017-12-13 23:29:12 -06:00
Caleb Burks c7f5ee97db Hide variation stock status setting conditionally 2017-12-13 22:38:03 -06:00
Caleb Burks fdd6e8be15 Update image descriptions 2017-12-13 21:22:38 -06:00