You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{"generator":"Code Snippets v2.13.3","date_created":"2020-01-17 19:45","snippets":[{"name":"Change Product Button Link on Out of Stock Products in WooCommerce","desc":"https:\/\/stackoverflow.com\/questions\/49523236\/change-read-more-button-link-on-out-of-stock-woocommerce-products","tags":["out","of","stock","product","url","link","custom","woocommerce"],"scope":"global","code":"add_filter( 'woocommerce_product_add_to_cart_url', 'out_of_stock_read_more_url', 50, 2 );\nfunction out_of_stock_read_more_url( $link, $product ) {\n \/\/ Only for \"Out of stock\" products\n if( $product->get_stock_status() == 'outofstock' ){\n\n \/\/ Here below we change the link\n $link = home_url(\"\/custom-page\/\");\n }\n return $link;\n}","priority":"10"}]}