Skip to content

Instantly share code, notes, and snippets.

@claudiosanches
Created November 23, 2012 15:01
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save claudiosanches/4136019 to your computer and use it in GitHub Desktop.
Save claudiosanches/4136019 to your computer and use it in GitHub Desktop.
WooCommerce - Customizar o summary do content-single-product.php
<?php
// Colar no functions.php
// Para remover os hooks
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title' );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price' );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt' );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart' );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta' );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_sharing' );
/*
No content-single-product.php você vai colocar as funções onde quer manualmente:
Exemplo:
Mostrar título:
<?php woocommerce_template_single_title(); ?>
Mostrar preço:
<?php woocommerce_template_single_price(); ?>
Mostrar resumo:
<?php woocommerce_template_single_excerpt(); ?>
Mostrar botão de adicionar no carrinho:
<?php woocommerce_template_single_add_to_cart(); ?>
Mostrar as informações do campo meta (geralmente tags, categorias e sku):
<?php woocommerce_template_single_meta(); ?>
Mostrar mostrar botões de compartilhamento (você deve configurar isso nas configurações do woocommerce):
<?php woocommerce_template_single_sharing(); ?>
Cada função leva para um template diferente do WooCommerce.
Como por exemplo o woocommerce_template_single_title() chama o template single-product/title.php
Para alterar como aparece o title, basta personalizar o template ou copiar o código e usar direto no content-single-product.php
Você entra informações dessas funções no arquivo woocommerce-template.php
*/
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment