lundi 2 août 2021

PHP Do shortcode if product attribute is in stock

I am trying do display the output of a shortcode on a woocommerce single product page depending on the stock status. If the product is in stock it needs to display the shortcode. I am not that experienced with php and i can't get it to work, the shortcode output is not displayed.

This is my code:

<?php $product->get_attribute( 'product-status'
if($product->get_attribute=="in-stock") {
 echo do_shortcode("[rey_estimated_delivery]"); ?>

What am i missing? I would also like to add a if statement later on. Any help would be appreciated.

Aucun commentaire:

Enregistrer un commentaire