wc_get_loop_prop()
Gets a property from the woocommerce_loop global.
No Hooks.
Return
Mixed
.
Usage
wc_get_loop_prop( $prop, $default );
- $prop(string) (required)
- Prop to get.
- $default(string)
- Default if the prop does not exist.
Default: ''
Changelog
Since 3.3.0 | Introduced. |
wc_get_loop_prop() wc get loop prop code WC 8.7.0
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; }