How to add a custom button with link to main category inside "added to cart" message on single product page of the currect product.
For clarity of the position of the custom button, see image:
I know how to add button with link to main shop page.
add_filter( 'wc_add_to_cart_message_html', 'my_custom_add_to_cart_message' );
function my_custom_add_to_cart_message( $message ) {
$message .= sprintf( '<a href="%s" class="button wc-forward back-to-shop" style="margin-right: 15px;">%s</a>', get_permalink( woocommerce_get_page_id( 'shop' ) ), 'Continue');
return $message;
}
But i don't know how to make a link to last or main product category.
Using Woocommerce Continue Shopping Button Link to Last Product Category Page answer code does not work for me as it is not quite what I am looking for.
