WooCommerce::get_tracking_history
Tracks the history WooCommerce Allow Tracking option.
- When the field was first set to allow tracking
- Last time the option was changed
Method of the class: WooCommerce{}
No Hooks.
Returns
null. Nothing (null).
Usage
$WooCommerce = new WooCommerce(); $WooCommerce->get_tracking_history( $old_value, $value );
- $old_value(string) (required)
- The old value for the woocommerce_allow_tracking option.
- $value(string) (required)
- The current value for the woocommerce_allow_tracking option.
Changelog
| Since . | Introduced. |
WooCommerce::get_tracking_history() WooCommerce::get tracking history code WC 10.7.0
public function get_tracking_history( $old_value, $value ) {
// If woocommerce_allow_tracking_first_optin is not set. It means is the first time it gets set.
if ( ! get_option( 'woocommerce_allow_tracking_first_optin' ) && 'yes' === $value ) {
update_option( 'woocommerce_allow_tracking_first_optin', time() );
}
// Always update the last change.
update_option( 'woocommerce_allow_tracking_last_modified', time() );
}