Created
November 30, 2019 10:53
-
-
Save m3esma/92e414a7e319a50775143f15b861294f to your computer and use it in GitHub Desktop.
WooCommerce - Custom pricing.
This file contains hidden or 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
<?php | |
// Do NOT include the opening php tag. | |
// Set custom price. | |
function m3wc_woocommerce_product_get_price( $price, $product ) { | |
// Do any calculations or conditions here. | |
// For example1: Set a different price for each type of user. | |
// For example2: $price = $price + ( $price * 0.09 ); Adding 9% of the price. | |
return $price; | |
} | |
add_filter( 'woocommerce_product_get_price', 'm3wc_woocommerce_product_get_price', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment