0

i am finding how to change the value from _stock_status on single product. I have display the product stock status by that code:

<?php echo get_post_meta( get_the_ID(), '_stock_status', true ); ?>

but '_stock_status' return the value: "outofstock". I want to change this value to other name

Please help me to solve this. Thank you in advance

0

You can use the code update_post_meta( get_the_ID(), '_stock_status',$value) to change the value of the meta. Please place the above line in the code where you want to change the status value and remember $value is the variable/array/object you can place any string/array/object in it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.