Last active
June 24, 2017 15:04
-
-
Save wooexperte/59613761badefec43e33ce25afbfb6db to your computer and use it in GitHub Desktop.
Anzahl der verkauften Produkte in der WooCommerce Produktbeschreibung
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Anzahl der verkauften Produkte in der WooCommerce Produktbeschreibung | |
* https://wooexperte.de/snippet/verkaufte-produkte-woocommerce-produktbeschreibung/ | |
*/ | |
add_action( 'woocommerce_single_product_summary', 'wc_product_sold_count', 11 ); // Zahl bestimmt die Position | |
function wc_product_sold_count() { | |
global $product; | |
$units_sold = get_post_meta( $product->id, 'total_sales', true ); | |
echo '<p>' . sprintf( __( 'Verkaufte Produkte: %s', 'woocommerce' ), $units_sold ) . '</p>'; // Text anpassen | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment