PluginProbe
Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO / 1.4.20
Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO v1.4.20
1.4.21 1.4.20 1.4.19 1.4.18 1.4.17 1.4.16 1.4.15 1.4.14 1.4.13 1.4.12 1.4.11 1.4.10 1.4.9 1.4.8 1.4.7 1.4.6 1.4.5 1.4.4 1.4.3 1.4.2 1.4.1 1.4.0 1.3.54 1.3.53 1.3.52 All 184 releases
← All changes | rest/CampaignApi.php +12 -0 1.4.14 → 1.4.20 View file →
@@ -152,8 +152,20 @@
152 152 array( 'status' => 404 )
153 153 );
154 154 }
155 155
156 + /**
157 + * Newest first.
158 + *
159 + * Campaign::get_campaigns() returns rows in insertion order, so the list showed the
160 + * oldest campaign at the top. Sorted by id here rather than in the query
161 + * or in Campaign::get_rows(): that order is also the order the intents
162 + * are evaluated in, and it decides which campaign is credited when two
163 + * produce the same discount, so reversing it there would quietly change
164 + * attribution on the storefront.
165 + */
166 + krsort( $campaigns, SORT_NUMERIC );
167 +
156 168 foreach ( $campaigns as $campaign ) {
157 169 $response = $this->prepare_item_for_response( $campaign, $request );
158 170 $data[] = $this->prepare_response_for_collection( $response );
159 171 }