Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mohammadYousefiDev/8cefa607d5c603f64df2b2a7991c3684 to your computer and use it in GitHub Desktop.
Save mohammadYousefiDev/8cefa607d5c603f64df2b2a7991c3684 to your computer and use it in GitHub Desktop.
change external product url in woocommerce
function override_external_product_url( $url, $product )
{
if ( 'external' === $product->get_type() )
{
$url = 'https://biawp.ir';
}
return $url;
}
add_filter( 'woocommerce_product_add_to_cart_url', 'override_external_product_url', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment