PluginProbe
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster / 2.7.0
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster v2.7.0
2.7.0 2.6.0 trunk 1.1.0 1.1.4 1.2.1 1.2.2 1.2.3 1.2.5 1.2.9 1.3.1 1.3.2 1.5.0 1.5.1 1.5.4 1.5.7 1.5.8 1.5.9 1.6.2 1.6.5 1.6.8 1.7.2 1.7.4 1.7.5 1.7.9 All 43 releases
← All changes | includes/elementor/modules/checkout/classes/helper.php +13 -3 1.7.92.7.0 View file →
@@ -90,9 +90,11 @@
90 90 public function get_user_defined_fields_slug( $user_defined_fields, $type ) {
91 91 $fields = [];
92 92
93 93 foreach ( $user_defined_fields as $field ) {
94 - $fields[] = $field[ $type ];
94 + if ( isset( $field[ $type ] ) ) {
95 + $fields[] = $field[ $type ];
96 + }
95 97 }
96 98
97 99 return $fields;
98 100 }
@@ -241,8 +243,10 @@
241 243 * @since 1.1.0
242 244 * @SuppressWarnings(PHPMD.CyclomaticComplexity)
243 245 */
244 246 public function validate_user_defined_fields( $shipping_fields, $billing_fields ) {
247 + $shipping_destination = get_option( 'woocommerce_ship_to_destination', true );
248 +
245 249 foreach ( $shipping_fields as $data ) {
246 250 // Escape all if cart does not need shipping information.
247 251 if ( ! WC()->cart->needs_shipping() ) {
248 252 continue;
@@ -247,8 +251,13 @@
247 251 if ( ! WC()->cart->needs_shipping() ) {
248 252 continue;
249 253 }
250 254
255 + // Escape all if shipping destination be billing only.
256 + if ( 'billing_only' === $shipping_destination ) {
257 + continue;
258 + }
259 +
251 260 $final_name = isset( $data['shipping_list_field'] ) ? $data['shipping_list_field'] : '';
252 261
253 262 if ( 'custom_role' === $final_name ) {
254 263 $final_name = 'shipping_' . $data['_id'];
@@ -280,9 +289,9 @@
280 289 $this->postcode_validation( $data, $final_name, 'shipping', $label );
281 290 }
282 291
283 292 foreach ( $billing_fields as $data ) {
284 - $final_name = $data['billing_list_field'];
293 + $final_name = isset( $data['billing_list_field'] ) ? $data['billing_list_field'] : '';
285 294
286 295 if ( 'custom_role' !== $final_name ) {
287 296 continue;
288 297 }
@@ -485,8 +494,9 @@
485 494 $item = [
486 495 'show_in_thank_you' => ( 'yes' === $data[ $type . '_show_in_thankyou' ] ) ? 'yes' : 'no',
487 496 'show_in_email' => ( 'yes' === $data[ $type . '_show_in_order_mail' ] ) ? 'yes' : 'no',
488 497 'key_name' => $final_name,
498 + 'label' => $data[ $type . '_list_placeholder' ],
489 499 ];
490 500
491 501 return $item;
492 502 }
@@ -508,9 +518,9 @@
508 518 unset( $default_fields['billing']['billing_email'] );
509 519
510 520 // Make it optional.
511 521 foreach ( $widget_billing_fields as $data ) {
512 - $slug = $data['billing_list_field'];
522 + $slug = isset( $data['billing_list_field'] ) ? $data['billing_list_field'] : '';
513 523 $is_required = false;
514 524
515 525 if ( 'custom_role' === $slug ) {
516 526 continue;