• Resolved amirin

    (@amirin)


    I have multiple shortcode button(subscribe to download popup) and each short code is associated with it’s own product. Examples of shortcode :
    [std alias=”ebook1″]for Product 1, [std alias=”ebook2″] for Product 2,etc. I like to display in the shop page(not in the single product page) these shortcode button under Add to Cart button for every product listed in the shop page.
    Purpose is to allow visitors to download free ebooks after subscription at the shop page itself without having to go to single product page and cart page.

    If anyone can help, I will greatly appreciate.thanks

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Mirko P.

    (@rainfallnixfig)

    Hi @amirin,

    You’d want to start with overriding the archive-product.php file in /wp-content/plugins/woocommerce/templates/ which is the template file that displays the shop’s main products overview.

    Here’s our documentation on how to do this: https://docs.woocommerce.com/document/template-structure/

    Since this is a fairly complex development topic I’m going to leave this thread 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 Community 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.

    Thread Starter amirin

    (@amirin)

    Hi Team,
    I was able to add the Shortcode download button(subscription form) to the product archive page and the single product page. I’m using the short description field of the product to pass the shortcode.
    In the shop page, I have added the following code in my functions.php of the theme to get the short description. The download button appears correctly, however when clicked it takes me to the single product page rather than showing the subscription popup. In the single product page, the download button is working correctly and when clicked- the pop subscription appears. How can I make the subscription pop up work on the shop page without having to go to a single product page? Appreciate if anyone could help.

    Link to shop page : https://safetydocument.com/documents
    Code used in Theme’s functions.php:

    add_action( ‘woocommerce_after_shop_loop_item_title’, ‘wc_add_short_description’ );
    /**
    * WooCommerce, Add Short Description to Products on Shop Page
    */
    function wc_add_short_description() {
    global $product;

    ?>
    <div itemprop=”description”>
    <?php echo apply_filters( ‘woocommerce_short_description’, $product->get_short_description() ) ?>
    </div>
    <?php
    }

    • This reply was modified 2 years, 11 months ago by amirin.

    Hi @amirin

    As this is a development oriented topic the thread is open for anyone to chime in to help you out here.

    If useful inputs are not received here you can also reach out to the development related resource channels listed above for help.

    Thanks

    Seems we’ve not had additional inputs on this thread. Thus, we encourage you to make use of the above resources.

    I’ll go ahead and mark the thread closed but please feel free to create a new thread if you have other questions related to core WooCommerce.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to add custom shortcode button below Add to Cart in the shop page?’ is closed to new replies.