Open "Buy Now" links in new window

By default, the Datafeedr WooCommerce Importer plugin will make the [Buy Now] button open in a new window/tab on WooCommerce Single Product page. If this is not working for you, try deactivating any "new window/tab" plugin you may have installed.

However, by default, [Buy Now] buttons do NOT open in a new window on WooCommerce Archive / Category / Storefront pages. To force the [Buy Now] buttons to open in a new tab/window from those pages, add the following code to your custom plugin:

add_filter( 'woocommerce_loop_add_to_cart_args', function ( array $args, WC_Product $product ) {
   if ( $product->is_type( 'external' ) ) {
      $args['attributes']['target'] = '_blank';

   return $args;
}, 10, 2 );
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us