Skip to content

Instantly share code, notes, and snippets.

@claudiosanches
Created December 18, 2012 23:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save claudiosanches/4333017 to your computer and use it in GitHub Desktop.
Save claudiosanches/4333017 to your computer and use it in GitHub Desktop.
WooCommerce - Ocultar o preço para produtos com variáveis.
<?php
/**
* Single Product Price, including microdata for SEO
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 1.6.4
*/
global $post, $product;
?>
<?php if ( $product->product_type != 'variable' ) : ?>
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<p itemprop="price" class="price"><?php echo $product->get_price_html(); ?></p>
<link itemprop="availability" href="http://schema.org/<?php echo $product->is_in_stock() ? 'InStock' : 'OutOfStock'; ?>" />
</div>
<?php endif; ?>
@gabrielporfiro
Copy link

gabrielporfiro commented Nov 16, 2021

Top, fiz uma adição a um plugin que criei usando isso, valeu.

@pabloalbano
Copy link

uso esse código em functions.php ?

@gabrielporfiro
Copy link

uso esse código em functions.php ?

Não, usa no arquivo responsavel pelo loop das postagens wordpress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment