How do I add back on order to my woocommerce single product template?
-
So This is the code I have:
function phami_label_stock(){ global $product; $stock = ( $product->is_in_stock() )? 'in-stock' : 'out-stock' ; ?> <div class="product-stock <?php echo esc_attr( $stock ); ?>"> <span><?php esc_html_e( 'Availability:', 'phami' ); ?></span> <i class="fa fa-check"></i><span class="stock"><?php if( $product->is_in_stock() ){ echo esc_html__( 'In Stock', 'phami' ); }else{ echo esc_html__( 'Out of Stock', 'phami' ); } ?></span> <br> <span><?php esc_html_e( 'Lead Time:', 'phami' ); ?></span> <i></i><span class="stock"><?php if( $product->is_in_stock() ){ echo $product->get_stock_quantity().' '.esc_html__( 'Available for Immediate Dispatch', 'phami' ); }else{ echo esc_html__( 'Not Available - Contact Us For Further Information', 'phami' ); } ?></span> </div> <?php }
As seen, I have 2 things that are being displayed. Firstly whether it is in stock. Secondly. the leadtime and when it is avalivable. I would want to add another condition to these 2 statements. 1 for leadtime and one for stock.
So this is my conditional for stock –
1.) if Product is in stock – Should say “In stock”
2.) if Product is out of stock – Should say “Out of stock”
3.) if Product is back in order – Should say “Avaivable on back order!”This is my conditional for leadtime –
1.) if Product is in stock – Should say “Avalivable for immideate dispatch.”
2.) if Product is out of stock – Should say “Not Available – Contact Us For Further Information.”
3.) if Product is back in order – Should say “should display 3-5 days delivery.”Thank you for your help. If you need anything else, let me know. ?? I appiriceate this amazing blog platform.
I know this is big but i would appriceate if anyone would help me ??
Regards,
Oliver
The page I need help with: [log in to see the link]
- The topic ‘How do I add back on order to my woocommerce single product template?’ is closed to new replies.