wc_get_loop_prop( string $prop, string $default = '' )

Gets a property from the woocommerce_loop global.


Description Description


Parameters Parameters

$prop

(Required) Prop to get.

$default

(Optional) Default if the prop does not exist.

Default value: ''


Top ↑

Return Return

(mixed)


Top ↑

Source Source

File: includes/wc-template-functions.php

function wc_get_loop_prop( $prop, $default = '' ) {
	wc_setup_loop(); // Ensure shop loop is setup.

	return isset( $GLOBALS['woocommerce_loop'], $GLOBALS['woocommerce_loop'][ $prop ] ) ? $GLOBALS['woocommerce_loop'][ $prop ] : $default;
}

Top ↑

Changelog Changelog

Changelog
Version Description
3.3.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.