@@ 491-496 (lines=6) @@ | ||
488 | $product_ids = array_filter( array_map( 'absint', (array) get_post_meta( $post->ID, '_upsell_ids', true ) ) ); |
|
489 | $json_ids = array(); |
|
490 | ||
491 | foreach ( $product_ids as $product_id ) { |
|
492 | $product = wc_get_product( $product_id ); |
|
493 | if ( is_object( $product ) ) { |
|
494 | $json_ids[ $product_id ] = wp_kses_post( html_entity_decode( $product->get_formatted_name(), ENT_QUOTES, get_bloginfo( 'charset' ) ) ); |
|
495 | } |
|
496 | } |
|
497 | ||
498 | echo esc_attr( json_encode( $json_ids ) ); |
|
499 | ?>" value="<?php echo implode( ',', array_keys( $json_ids ) ); ?>" /> <?php echo wc_help_tip( __( 'Up-sells are products which you recommend instead of the currently viewed product, for example, products that are more profitable or better quality or more expensive.', 'woocommerce' ) ); ?> |
|
@@ 508-513 (lines=6) @@ | ||
505 | $product_ids = array_filter( array_map( 'absint', (array) get_post_meta( $post->ID, '_crosssell_ids', true ) ) ); |
|
506 | $json_ids = array(); |
|
507 | ||
508 | foreach ( $product_ids as $product_id ) { |
|
509 | $product = wc_get_product( $product_id ); |
|
510 | if ( is_object( $product ) ) { |
|
511 | $json_ids[ $product_id ] = wp_kses_post( html_entity_decode( $product->get_formatted_name(), ENT_QUOTES, get_bloginfo( 'charset' ) ) ); |
|
512 | } |
|
513 | } |
|
514 | ||
515 | echo esc_attr( json_encode( $json_ids ) ); |
|
516 | ?>" value="<?php echo implode( ',', array_keys( $json_ids ) ); ?>" /> <?php echo wc_help_tip( __( 'Cross-sells are products which you promote in the cart, based on the current product.', 'woocommerce' ) ); ?> |