P.S.
I know the plugin itself isn’t meant to reduce the actual stock, but could it do that? And re-add it if the checkout is not complete?
Thank you.
P.P.S.
I am quite slow today, I apologise. Your plugin works perfectly, I was looking at it from the wrong angle. On a more appropriate note, could you please tell me what code should I use in order for another line of text under “Items left” titled “Pending orders”: next to which it should specify how many items are currently pending? Could I do that with the appropriate coding? (don’t know how exactly you named and coded each aspect of what your plugin does and it would be quite difficult for me to know the variables by myself).
Thank you, and sorry for changing the quetsion.
Glad you were able to figure it out.
There is a function (quantity_in_carts)to return the number of items in a cart, though it was never really planned on being accessible to the end user.
I suspect the easiest way would be to add code to create a shortcode that returns that information. If you end up doing this, please submit a pull request and I can integrate it in a future version.
Well I am going to start looking into how to integrate it, and if I manage to do it I will post it. If you have any ideas, feel free to share with me, we might reach a nice end result.
Thank you.
add_action( ‘woocommerce_after_shop_loop_item_title’, ‘quantity_in_carts’, 15);
function quantity_in_carts() {
global $product;
echo “Numbers pending: “.$product->quantity_in_carts;
}
it does not do anything sadly, because:
1.I need the first function (basic one would be my_stock for a normal stock display), and at the end, after $product, i would need what would be the equivalent of total_stock, but the funciton that will display actualy quantity_in_carts
any thoughts?
EDIT:I have tried multiple variations from which I found in your .php on the plugin, including only $in_carts, $stock, etc. the base codeline should be that which I have just gave you, but the functions, aswell as $product might need to differ.
Let me know what you find out.
I just added code to the github repository to add the count of items pending in carts. After further testing I will release a new version here.