I am trying to customize a WooCommerce notice. This is the notice I am trying to replace:
wc_add_notice( sprintf( __( '%s has been removed from your cart because it can no longer be purchased. Please contact us if you need assistance.', 'woocommerce' ), $_product->get_title() ), 'error' )
Based on this helpful answer WooCommerce Notice Messages, how do I edit them?, I came up with this:
function my_woocommerce_membership_notice( $error ) {
if ( '%s has been removed from your cart because it can no longer be purchased. Please contact us if you need assistance.' == $error ) {
$error = '%s has been removed from your cart because you added a membership product. Please complete the membership purchase first.';
}
return $error;
}
add_filter( 'woocommerce_add_error', 'my_woocommerce_membership_notice' );
This results in HTTP500 errors and I can't figure out why exactly.
Thanks!
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire