@@ 106-111 (lines=6) @@ | ||
103 | $product_ids = array_filter( array_map( 'absint', explode( ',', get_post_meta( $post->ID, 'product_ids', true ) ) ) ); |
|
104 | $json_ids = array(); |
|
105 | ||
106 | foreach ( $product_ids as $product_id ) { |
|
107 | $product = wc_get_product( $product_id ); |
|
108 | if ( is_object( $product ) ) { |
|
109 | $json_ids[ $product_id ] = wp_kses_post( $product->get_formatted_name() ); |
|
110 | } |
|
111 | } |
|
112 | ||
113 | echo esc_attr( json_encode( $json_ids ) ); |
|
114 | ?>" value="<?php echo implode( ',', array_keys( $json_ids ) ); ?>" /> <?php echo wc_help_tip( __( 'Products which need to be in the cart to use this coupon or, for "Product Discounts", which products are discounted.', 'woocommerce' ) ); ?></p> |
|
@@ 124-129 (lines=6) @@ | ||
121 | $product_ids = array_filter( array_map( 'absint', explode( ',', get_post_meta( $post->ID, 'exclude_product_ids', true ) ) ) ); |
|
122 | $json_ids = array(); |
|
123 | ||
124 | foreach ( $product_ids as $product_id ) { |
|
125 | $product = wc_get_product( $product_id ); |
|
126 | if ( is_object( $product ) ) { |
|
127 | $json_ids[ $product_id ] = wp_kses_post( $product->get_formatted_name() ); |
|
128 | } |
|
129 | } |
|
130 | ||
131 | echo esc_attr( json_encode( $json_ids ) ); |
|
132 | ?>" value="<?php echo implode( ',', array_keys( $json_ids ) ); ?>" /> <?php echo wc_help_tip( __( 'Products which must not be in the cart to use this coupon or, for "Product Discounts", which products are not discounted.', 'woocommerce' ) ); ?></p> |