mardi 30 décembre 2014

How to customize Woocommerce is_sold_individually() notice [on hold]


line 925 of includes/class-wc-cart.php is:



// Downloadable/virtual qty check
if ( $product_data->is_sold_individually() ) {
$in_cart_quantity = $cart_item_key ? $this->cart_contents[ $cart_item_key ]['quantity'] : 0;
// If it's greater than 0, it's already in the cart
if ( $in_cart_quantity > 0 ) {
wc_add_notice( sprintf(
'<a href="%s" class="button wc-forward">%s</a> %s',
$this->get_cart_url(),
__( 'View Cart', 'woocommerce' ),
sprintf( __( 'You cannot add another &quot;%s&quot; to your cart.', 'woocommerce' ), $product_data->get_title() )
), 'error' );
return false;
}
}


Obviously I don't want to edit that file, but I need to customize the message. Been googling for hours and can't find an easy solve. I have been looking for a filter or function to modify.


What I want is a method to modify this from functions.php or a pluggable function.


Any help us very much appreciated.





Aucun commentaire:

Enregistrer un commentaire