Make consistent with checkout and rename filter

This commit is contained in:
Mike Jolley 2019-01-31 15:46:26 +00:00
parent 3e4791fbb4
commit 25ebc45fbc
1 changed files with 5 additions and 3 deletions

View File

@ -1942,12 +1942,14 @@ class WC_Cart extends WC_Legacy_Cart {
/**
* Returns the hash based on cart contents.
*
* @since 3.6.0
* @return string hash for cart content
*/
public function get_cart_hash() {
$cart = $this->session->get_cart_for_session();
$hash = $cart ? md5( json_encode( $cart ) ) : '';
$cart_session = $this->session->get_cart_for_session();
$hash = $cart_session ? md5( wp_json_encode( $cart_session ) . $this->get_total( 'edit' ) ) : '';
$hash = apply_filters_deprecated( 'woocommerce_add_to_cart_hash', array( $hash, $cart_session ), '3.6.0', 'woocommerce_cart_hash' );
return apply_filters( 'woocommerce_add_to_cart_hash', $hash, $cart );
return apply_filters( 'woocommerce_cart_hash', $hash, $cart_session );
}
}