Cart::generate_cart_order_hash( string $salt = '' )

Generates a unique version of the cart hash, used to enforce idempotency in REST API requests.


Parameters #

$salt

(string) (Optional) An optional value to make sure the generated hash is not directly translatable to the cart hash.

Default value: ''


Top ↑

Return #

(string)


Top ↑

Source #

File: src/Tickets/Commerce/Cart.php

	public function generate_cart_order_hash( $salt = '' ): string {
		$cart_hash = $this->get_cart_hash();

		/**
		 * Allows modifications to the cart/order hash for Tickets Commerce.
		 *
		 * @since 5.4.0.2
		 *
		 * @param string $cart_order_hash The md5-hashed cart hash.
		 * @param string $cart_hash       The current cart hash.
		 * @param string $salt            The salt value.
		 */
		return (string) apply_filters( 'tec_tickets_commerce_cart_order_hash', md5( $cart_hash . $salt ), $cart_hash, $salt );
	}

Top ↑

Changelog #

Changelog
Version Description
5.4.0.2 Introduced.