abluedeveloper
Forum Replies Created
-
Forum: Plugins
In reply to: [Giftable for WooCommerce] Gift Out Of Stock NoticeThanks for getting back so quick. I guess this is a corner case but I’d need to be able to inform customers if we’ve sold out of a gift.
I was able to put together a fix for use case with a nice little table on my cart page’s sidebar.
Orginal Code from https://stackoverflow.com/questions/32837586/how-to-display-stock-quantity-of-a-product-in-text-in-woocommerce
I modified it so it would output text if the given item is out of stock.
If anyone’s interested here’s the code, put it in your functions.php
Usage is [product_stock id=”16235″] where the id is the wordpress id not product sku.add_shortcode('product_stock', 'product_stock'); function product_stock( $atts ) { if ( ! $atts['id'] ) { return ''; } $product = get_product($atts['id']); if ($product->stock < 1){ return 'Gift Out Of Stock'; // Message to show if gift is out of stock. } else { return 'Only ' . $product->stock . ' Left'; // prints 22, ie the qty of product 1592 } }- This reply was modified 8 years, 6 months ago by abluedeveloper.
Forum: Plugins
In reply to: [Giftable for WooCommerce] Gift Out Of Stock NoticeI also tried putting a little note in the plugin settings telling customers if they don’t see a gift it’s out of stock.
But on some items Say I only want 1 gift open but it’s out of stock it hides the whole area so I can’t even tell the customers it’s out of stock.
PS great plugin. Thanks for the effort into it.