• Resolved contremaitre

    (@contremaitre)


    Hello,
    I would like to add short description to a product shortcode, but not on all shortcodes.
    For exemple with a shortcode like :
    [product_category category=”xxxx” show_desc=”true”]

    I found a code to display shordcodes :

    add_action( 'woocommerce_after_shop_loop_item_title', 'custom_short_description', 45 );
    
    function custom_short_description() {
        global $product;
            ?>   
            <div itemprop="description">
                <?php echo apply_filters( 'woocommerce_short_description', $product->get_short_description() ) ?>
            </div>
            <?php
    }

    How could I get my option show_desc inside this function to display the description only in this case ?

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Gabriel – a11n

    (@gabrielfuentes)

    Hi there ??

    This is a fairly complex development topic. I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    I can also recommend the WooCommerce Developer Resources Portal for resources on developing for WooCommerce.

    You can also visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.

    Cheers.

    Plugin Support Gabriel – a11n

    (@gabrielfuentes)

    We’ve not seen any activity on this thread for a while, so I’m marking this thread as resolved.

    Hopefully, you were able to find a solution to your problem! If you have further questions, please feel free to open a new topic.

    Cheers!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Conditionnaly add short description to product shortcode’ is closed to new replies.