claudiosanches

WooCommerce - Open external products in new tab

Dec 14th, 2015
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.08 KB | None | 0 0
  1. <?php
  2. /**
  3.  * External product add to cart
  4.  *
  5.  * This template can be overridden by copying it to yourtheme/woocommerce/single-product/add-to-cart/external.php.
  6.  *
  7.  * HOWEVER, on occasion WooCommerce will need to update template files and you (the theme developer).
  8.  * will need to copy the new files to your theme to maintain compatibility. We try to do this.
  9.  * as little as possible, but it does happen. When this occurs the version of the template file will.
  10.  * be bumped and the readme will list any important changes.
  11.  *
  12.  * @see         http://docs.woothemes.com/document/template-structure/
  13.  * @author      WooThemes
  14.  * @package     WooCommerce/Templates
  15.  * @version     2.1.0
  16.  */
  17.  
  18. if ( ! defined( 'ABSPATH' ) ) {
  19.     exit; // Exit if accessed directly
  20. }
  21.  
  22. ?>
  23.  
  24. <?php do_action( 'woocommerce_before_add_to_cart_button' ); ?>
  25.  
  26. <p class="cart">
  27.     <a href="<?php echo esc_url( $product_url ); ?>" rel="nofollow" class="single_add_to_cart_button button alt" target="_blank"><?php echo esc_html( $button_text ); ?></a>
  28. </p>
  29.  
  30. <?php do_action( 'woocommerce_after_add_to_cart_button' ); ?>
Advertisement
Add Comment
Please, Sign In to add comment