In woocommerce/classes/abstracts/abstract-wc-product.php on line 338.
The is_sold_individualy function is default “false”.
Is there a way to set this default option to “true”? So in de WordPress back-end the checkbox is checked by default?
function is_sold_individually() {
$return = false;
if ( 'yes' == $this->sold_individually || ( ! $this->backorders_allowed() && $this->get_stock_quantity() == 1 ) ) {
$return = true;
}
return apply_filters( 'woocommerce_is_sold_individually', $return, $this );
}
Thanks in advance,
Mirjam
You can use a built-in function from WordPress:
This line in a separate plugin will set the value always to
true
.You want it to be true all the time? The
apply_filters()
is your tip off that you can modify this value for any or all products.