PluginProbe
Tiered Pricing Table for WooCommerce / 8.1.0
Tiered Pricing Table for WooCommerce v8.1.0
8.1.0 8.0.2 7.1.7 7.1.5 7.1.4 7.1.1 6.5.0 6.4.0 6.1.0 trunk 1.0 1.1 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.3.0 2.3.1 2.3.2 All 92 releases
tier-pricing-table / src / Addons / GlobalTieredPricing / CPT / GlobalRulesQuery.php

GlobalRulesQuery.php in Tiered Pricing Table for WooCommerce 8.1.0, at src/Addons/GlobalTieredPricing/CPT/GlobalRulesQuery.php

40 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php namespace TierPricingTable\Addons\GlobalTieredPricing\CPT;
2
3 /**
4 * Query arguments for the global pricing rules that take part in pricing.
5 */
6 class GlobalRulesQuery {
7
8 /**
9 * Published rules that are not suspended.
10 *
11 * A "!=" comparison alone would also drop every rule without a "_tpt_is_suspended" row (rules
12 * created before the suspend action existed and not saved since), because the comparison needs
13 * the meta row to exist. Rules without the row are active.
14 *
15 * @param string $postType The rules' post type.
16 *
17 * @return array get_posts() arguments.
18 */
19 public static function args( string $postType ): array {
20 return array(
21 'numberposts' => - 1,
22 'post_type' => $postType,
23 'post_status' => 'publish',
24 'fields' => 'ids',
25 'meta_query' => array(
26 'relation' => 'OR',
27 array(
28 'key' => '_tpt_is_suspended',
29 'compare' => 'NOT EXISTS',
30 ),
31 array(
32 'key' => '_tpt_is_suspended',
33 'value' => 'yes',
34 'compare' => '!=',
35 ),
36 ),
37 );
38 }
39 }
40