Notice: These forums are now retired and closed. For active support, please Submit a Ticket or visit our official WordPress.org community pages.
Kadence Theme | Kadence Blocks | Starter Templates | WooCommerce Email Designer | Ascend | Virtue | Pinnacle

Add link from product page to itself

Home / Forums / Virtue Theme / Add link from product page to itself

This topic is: Resolved
[Resolved]
Posted in: Virtue Theme
April 4, 2016 at 1:10 pm

Hi,

I’m trying to add a text link from the product page to itself. Sounds redundant but it’s for products that are shown elsewhere on my website, in a list. It’s so users can click and be taken to the shop page to see more information, rather than add the products directly to their carts. I would only like it to display for products that are currently in stock.

So far I found a bit of code that displays a message when an item is in stock, but I cannot customize the message, let along make it link to the product page:

// Hook in
add_filter( 'woocommerce_get_availability', 'custom_override_get_availability', 1, 2);

// The hook in function $availability is passed via the filter!
function custom_override_get_availability( $availability, $_product ) {
if ( $_product->is_in_stock() ) $availability['availability'] = __('In Stock', 'woocommerce');
return $availability;
}

Further searching for code snippets hasn’t led me to any solutions. If you know a way of making this work that would be amazing.

Thanks!

-Adam

  • The forum ‘Virtue Theme’ is closed to new topics and replies.