PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / 1.10.23
WCPOS – Point of Sale (POS) plugin for WooCommerce v1.10.23
1.10.24 1.10.23 1.10.22 1.10.21 1.10.20 1.10.19 1.10.18 1.10.17 1.10.16 1.10.15 1.10.13 1.10.14 1.10.12 1.10.11 1.10.10 1.10.9 1.10.8 untagged-3d9b7ccddc54df87c672 1.10.7 1.10.6 1.10.5 1.10.3 1.10.4 1.10.2 1.10.1 All 168 releases
← All changes | includes/API/V1/Orders_Controller.php +2 -19 1.10.24 → 1.10.23 View file →
@@ -1136,29 +1136,11 @@
1136 1136 if ( ! isset( $request['coupon_lines'] ) || ! \is_array( $request['coupon_lines'] ) ) {
1137 1137 return false;
1138 1138 }
1139 1139
1140 - // Drop the POS's deletion markers (`{ id, code: null }`, the shape wc/v3 honours
1141 - // for every other line collection) before the comparison: the remaining codes
1142 - // then differ from the stored set and the parent's remove-and-reapply removes
1143 - // the coupon. Forwarded as-is, the marker is a codeless line and wc/v3 400s.
1144 - // Only an existing order can carry a synced coupon line: on a create (order
1145 - // not yet saved) every line is forwarded as posted so wc/v3 still rejects it.
1146 - $coupon_lines = $request['coupon_lines'];
1147 - if ( $order->get_id() > 0 ) {
1148 - $coupon_lines = array_values(
1149 - array_filter(
1150 - $coupon_lines,
1151 - static function ( $line ) {
1152 - return ! Order_Write_Payload::is_coupon_deletion_marker( $line );
1153 - }
1154 - )
1155 - );
1156 - }
1157 -
1158 1140 // Extract coupon codes from the request.
1159 1141 $requested_codes = array();
1160 - foreach ( $coupon_lines as $item ) {
1142 + foreach ( $request['coupon_lines'] as $item ) {
1161 1143 $code = $item['code'] ?? '';
1162 1144 if ( '' !== $code ) {
1163 1145 $requested_codes[] = wc_strtolower( wc_format_coupon_code( wc_clean( $code ) ) );
1164 1146 }
@@ -1181,8 +1163,9 @@
1181 1163 return false;
1182 1164 }
1183 1165
1184 1166 // Codes have changed — strip IDs and let the parent handle remove-and-reapply.
1167 + $coupon_lines = $request['coupon_lines'];
1185 1168 foreach ( $coupon_lines as &$coupon_line ) {
1186 1169 unset( $coupon_line['id'] );
1187 1170 }
1188 1171 $request->set_param( 'coupon_lines', $coupon_lines );