• Hi there,

    I want to add some text above the cart button in shop page.
    I’m using the hook action_woocommerce_after_shop_loop_item_title in my Astra theme. The hook doesn’t work as expected.

    I try this code in a storefront child theme and the text is well displayed before the add cart button,

    But in Astra theme the text is displayed above the title, and I don’t succeed with other hook to put my information just above the add cart button.

    Is this a bug of Astra, or is there a solution ?

    Thx for your help.

    Cheers.

    Catherine.

    Here is my code.
    function action_woocommerce_after_shop_loop_item_title( ) {
    echo ‘<div class=”product-meta”><span class=”product-meta-label”>my texte here 1</span></div>’;
    };

    // add the action
    add_action( ‘woocommerce_after_shop_loop_item_title’, ‘action_woocommerce_after_shop_loop_item_title’, 60, 0 );

Viewing 1 replies (of 1 total)
  • Hi @catheg,

    Please try using the following code instead

    add_action('woocommerce_after_shop_loop_item_title' , 'action_woocommerce_after_shop_loop_item_title');
    
    function action_woocommerce_after_shop_loop_item_title(){
        echo "<div class='product-meta'><span class='product-meta-label'>my text here 1</span></div>";
    }

    I hope it helps. Feel free to reach out to us if you have any further queries.

    Kind regards,
    Herman 🙂

Viewing 1 replies (of 1 total)

The topic ‘woocommerce_after_shop_loop_item_title hook doesn’t work as espected’ is closed to new replies.