Allow max of 15 products in Recent Viewed Products widget

This commit is contained in:
Claudio Sanches 2017-11-29 19:24:39 -02:00
parent 929eb48fcd
commit 777a004a1f
2 changed files with 2 additions and 2 deletions

View File

@ -484,7 +484,7 @@ function wc_track_product_view() {
$viewed_products = (array) explode( '|', $_COOKIE['woocommerce_recently_viewed'] ); $viewed_products = (array) explode( '|', $_COOKIE['woocommerce_recently_viewed'] );
} }
// Unset if already in viewed products list and append ID. // Unset if already in viewed products list.
$keys = array_flip( $viewed_products ); $keys = array_flip( $viewed_products );
if ( isset( $keys[ $post->ID ] ) ) { if ( isset( $keys[ $post->ID ] ) ) {
unset( $viewed_products[ $keys[ $post->ID ] ] ); unset( $viewed_products[ $keys[ $post->ID ] ] );

View File

@ -33,7 +33,7 @@ class WC_Widget_Recently_Viewed extends WC_Widget {
'type' => 'number', 'type' => 'number',
'step' => 1, 'step' => 1,
'min' => 1, 'min' => 1,
'max' => '', 'max' => 15,
'std' => 10, 'std' => 10,
'label' => __( 'Number of products to show', 'woocommerce' ), 'label' => __( 'Number of products to show', 'woocommerce' ),
), ),