wc_order_attribution_origin_label
Filter the label for the order origin.
A label with a %s placeholder (any sprintf() string placeholder, or an escaped %%) has the formatted source inserted via sprintf(). A label without one, including a label with a lone percent sign, is used as the complete origin, which lets custom source types show their own text instead of "Unknown". An empty label falls back to the formatted source.
Usage
add_filter( 'wc_order_attribution_origin_label', 'wp_kama_wc_order_attribution_origin_label_filter', 10, 4 );
/**
* Function for `wc_order_attribution_origin_label` filter-hook.
*
* @param string $label The label for the order origin.
* @param string $source_type The source type.
* @param string $source The source.
* @param string $formatted_source The formatted source.
*
* @return string
*/
function wp_kama_wc_order_attribution_origin_label_filter( $label, $source_type, $source, $formatted_source ){
// filter...
return $label;
}
- $label(string)
- The label for the order origin.
- $source_type(string)
- The source type.
- $source(string)
- The source.
- $formatted_source(string)
- The formatted source.
Changelog
| Since 8.5.0 | Introduced. |
Where the hook is called
wc_order_attribution_origin_label
woocommerce/src/Internal/Traits/OrderAttributionMeta.php 360-366
$label = (string) apply_filters( 'wc_order_attribution_origin_label', $label, $source_type, $source, $formatted_source );