Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter ( 'woocommerce_product_add_to_cart_url', 'custom_woocommerce_product_add_to_cart_url', 10, 2 );
- function custom_woocommerce_product_add_to_cart_url( $url, $product )
- {
- if ( ! is_search ( ) )
- return $url;
- $url = $product->is_purchasable() && $product->is_in_stock() ? remove_query_arg(
- 'added-to-cart',
- add_query_arg(
- array(
- 'add-to-cart' => $product->get_id(),
- ),
- $product->get_permalink()
- )
- ) : $product->get_permalink();
- return $url;
- }
Advertisement
Add Comment
Please, Sign In to add comment