WC_Coupon::get_context_based_coupon_errors()
Returns alternate error messages based on context (eg. Cart and Checkout).
Method of the class: WC_Coupon{}
No Hooks.
Return
Array
. Context based alternate error messages.
Usage
$WC_Coupon = new WC_Coupon(); $WC_Coupon->get_context_based_coupon_errors( $err_code );
- $err_code(int)
- Message/error code.
Default: null
WC_Coupon::get_context_based_coupon_errors() WC Coupon::get context based coupon errors code WC 9.4.2
public function get_context_based_coupon_errors( $err_code = null ) { switch ( $err_code ) { case self::E_WC_COUPON_NOT_YOURS_REMOVED: return array( /* translators: %s: coupon code */ 'cart' => sprintf( __( 'Please enter a valid email at checkout to use coupon code "%s".', 'woocommerce' ), esc_html( $this->get_code() ) ), /* translators: %s: coupon code */ 'checkout' => sprintf( __( 'Please enter a valid email to use coupon code "%s".', 'woocommerce' ), esc_html( $this->get_code() ) ), ); default: return array(); } }